Reading the input from the file and storing the result into a file