Implement write().

Now generated gcode can be written out and actually run on a machine.