Since using shell loops for text processing is considered bad practice, I would recommend a different approach that uses dedicated text-processing tools. In particular, awk comes to mind:
awk '{printf "text %s text\n",$0}' textfile.txt
This will use Awk's builtin printf function (using the same formatting syntax as the well-known C function) to print the entire current line (represented by $0) enclosed by text on both ends.
As for why your approach didn't work, it can beAs for why your approach didn't work: Since you confirmed that if the text file was edited on a Windows-based machine, this means that the line endings are in a format the Linux doesn't correctly interpret. In that case, run the file through dos2unix, as in
dos2unix textfile.txt
The resulting file should be processed correctly.