nixcraft recommended awk and sed, which are both clean and accurate. However, I am not sure if you meant to say that you wanted to append something to “every line” in the existing text file? If so, then I would use sed (stream editor) to get there:
root# echo "this is a line" > my.txt
root# cat my.txt
this is a line
root# cat my.txt | sed 's/$/ \*NEWTEXT\*/' > mynewfile.txt
root# cat mynewfile.txt
this is a line *NEWTEXT*
Tools like grep, sed and awk can also pattern match, and swap in/out information easily.
One of my favorite actions is to strip out blank lines and comments from configuration files, so I can see what’s active.
cat config.txt | grep -v ^$ |grep -v "^#" | more
The first grep “ignores” blank lines, while the second ignores leading # symbols.
If you wanted to convert empty lines to comment markers, then sed would be great at that:
cat config.txt | sed 's/^$/# /' > revised_config.txt