Use the Map component and a LineString to capture your points. Displaying a LineString works here LineStringMap.aia (3.6 KB). App Inventor does not have a native way of generating a kml file.
See App Inventor GPS Trak Basics . GPS Traks using Static Maps or Map Component shows how to do make and save a LineString track using the Map component LineString (the preferred way in my opinion., The link also shows how to use a Static Map using a Google Map (more difficult for no real gain in advantage).
If you really need a kml file instead of saving points in a LineString, consider