write x, y, z to file