Read and write file in Chunks