Consider grep -v:
for thefile in *.txt ; do
grep -v "text to remove" $thefile > $thefile.$$.tmp
mv $thefile.$$.tmp $thefile
done
Grep -v shows all lines except those that match, they go into a temp file, and then the tmpfile is moved back to the old file name.