How do I edit a .KML File

When a text file is saved with a .kml or .kmz extension, Earth browsers know how to display it. 

To see the KML "code" for a feature in Google Earth, you can simply right-click the feature in the 3D Viewer of Google Earth and select Copy. Then Paste the contents of the clipboard into any text editor