code: def save_mission(aFileName):
      
      print("\nSave mission from Vehicle to file: %s" % aFileName)    
      #Download mission from vehicle
      missionlist = download_mission()
      #Add file-format information
      output='QGC WPL 110\n'
      #Add home location as 0th waypoint
      home = vehicle.home_location
      output+="%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" % (0,1,0,16,0,0,0,0,home.lat,home.lon,home.alt,1)
      #Add commands
      for cmd in missionlist:
          commandline="%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n" % (cmd.seq,cmd.current,cmd.frame,cmd.command,cmd.param1,cmd.param2,cmd.param3,cmd.param4,cmd.x,cmd.y,cmd.z,cmd.autocontinue)
          output+=commandline
      with open(aFileName, 'w') as file_:
          print(" Write mission to file")
          file_.write(output)
docs: Save a mission in the Waypoint file format 
      (http://qgroundcontrol.org/mavlink/waypoint_protocol#waypoint_file_format).