Takes an argument outfile and writes the output to the file