method for writing the downloadable file