writing MOG output