That sounds like your plain text viewer does not understand the
end-of-line sequence that you are writing. Most plain text software is
aware of the different options, but Notepad, to name a likely candidate,
does not care about anything else than *just* the magical 'Windows'
combination "Carriage Return/Linefeed" (hex codes: 0x0D 0x0A).
It would not be unreasonable to expect the Clipboard automatically
converting hard returns into "Windows format" -- at least for the Plain
Text Clipboard Format --, but apparently it does not.
So if you want your plain text to be Notepad-compatible, you have to
scan for either 0x0D *or* 0x0A codes, and replace each of them with the
sequence '0x0D+0x0A), before writing to a file.
Before you do so, inspect one of your current text files with a Hex
Viewer. Of course it's also possible you have something weird in your
code, or on your clipboard, and the reason you don't get to see hard
returns is because there *are* no hard returns of any kind in your file.
[Jw]