finish assignment. merge dataset and write results to file