File output code implemented for part1a