Takes input from file and writes to output file