new function appends data to a csv file