Add `write_ssxcusp_file()` convenience function.

This was necessary mostly because of having changed the semantics of
`write_ssxcusp_record()`, i.e. no longer appending the newline to each
record.
Refactor `write_ssxcusp_file()` into more generic `write_data_file()`.

This logic is needed for all 3 file types; might as well share it.