fwrite() is what is known as "binary-safe", meaning you can write binary data with it. That means that if you say fwrite($fp,"\n"); a single \n character will be written to the file.
On Windows machines, that is not the same as a new line. On Windows machines, new lines are represented by a sequence of two characters \r\n (in memory of old line-printer conventions). So if you want a line break in a text file intended for use on Windows machines, that is what you have to fwrite().
If fwrite() did this automatically on Windows machines - i.e., wasn't binary-safe, it would mangle pretty much every single binary file it wrote pretty much permanently and be useless for that purpose.