writes to file, ready to be read to sent to database