serial to file write