how to merge records into a file