You need to enable tesselate on the line geometry to follow the curvature of the earth.
Very large lines should enable tessellation so that
they follow the curvature of the earth (otherwise, they may go
underground and be hidden).
To enable tessellation, the value for <altitudeMode>
must be clampToGround or clampToSeaFloor otherwise tessellation flag will be ignored.
Make sure the generated KML output looks something like this:
<Placemark>
<name>line with tessellation</name>
<LineString>
<tessellate>1</tessellate>
<altitudeMode>clampToGround</altitudeMode>
<coordinates>
-122.383103,37.617112 -73.782201,40.643612
</coordinates>
</LineString>
</Placemark>
Python code to do this:
import simplekml
kml = simplekml.Kml()
firstcoord = (-122.383103, 37.617112)
secondcoord = (-73.782201, 40.643612)
line = kml.newlinestring(tessellate=1,
altitudemode=simplekml.AltitudeMode.clamptoground,
coords=[firstcoord, secondcoord])
print("Output: line.kml")
kml.save("line.kml")