It is an essential portable programming practice to use endl always, for writing newline characters (see newline) to a file will not terminate a line containing nets properly, and it will not flush the output buffer.
See also File, Manipulator, and Net.