Write struct to .txt in binary form