writing hex data into a file,f.write(chr(i))