added function for writing to simple text (non-csv) files