The first step is to create a new message and set the format to CSV - Comma Separated Values. In a CSV file each field is a node, so if you want the value in PID-3 to be the first field in the CSV file use the following:
var value = source.getNode("PID-3");
message.setNode("1", value);
The destination would be a file, with the Append to the file checkbox checked.