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