writing header in big-endian format