writing the readFile method