Hope this helps other newbies.
If you are writing data to a txt file on a windows system and need a line break. use \r\n . This will write hex OD OA.
i.e.
$batch_data= "some data... \r\n";
fwrite($fbatch,$batch_data);
The is the equivalent of opening a txt file in notepad pressing enter and the end of the line and saving it.