Do you perhaps need another fwrite operation between the two fputs?
As I recall, fput adds data to the output buffer, while fwrite submits the record. The fwrite function has a variety of options that allow you to specify the gap between each record (.e.g one line, two lines, etc.) so it might be worth looking up the online help for it.
... View more