You could just use "search and replace" with the search string being "\n" (in \codes display) and the replace string as "constant\n". (See attached image).
If the string you want at the beginning of each line is variable (e.g. line number), you should use e.g. "pick line" or "scan strings for tokens" in a loop, then rebuild the new string.