when you set header("Content-Type:text/plain"); or use it inside pre echo '<pre>'.$content.'</pre>;` then it should be work fine
Just like to add - I'm seeing a lot of issues with \n lately. If you use this as part of general html output, it will help to prettify the underlying html (e.g. see source view), but very little else. To actually see the newline as part of output to the screen, you need to do as shown by AndrisP. Be aware \n is not the same as the html <br />.
You could always use the PHP_EOL constant, which is a better platform-independent fit IMO: