Reading from file and printing and writing to file in base64