I am using the PHP code:
$numberNewline = $number . \'\\n\'; fwrite($file, $numberNewline);
to write $number to a file.
For some reason
'\n' in single quotes is a literal \n. "\n" in double quotes is interpreted as a line break.
'\n'
\n
"\n"
http://php.net/manual/en/language.types.string.php