reads from one file and writes to another uses scanner instead of iterator