merge script for output files