write a file with downloaded data