Append data from datamapper script

I have a post processing script in the data mapper the writes the record count to a csv file. Is it possible to append this data to the file rather than write a new file each time?

Here is my current script
var today = new Date();

var dateString = today.getFullYear() + ‘-’ + (today.getMonth() + 1) + ‘-’ + today.getDate();

var fileName = ‘C:\Test\B-HP_Alert.csv’;

var file = openTextWriter(fileName);

var lastRecordIndex = data.records.length - 1;

var field = data.records[lastRecordIndex].fields[“total record”];

file.write(dateString +‘",’+ field.toString());

file.write(‘\n’);

file.close();

You can add to the same file.

Please read this.