If you are getting the directions via the Javascript directions API, the following can all be done programmatically, but I am assuming you are getting your directions from the maps.google.com page? If so then you can get the KML associated with the directions response via My Maps.
After you make your directions request you need to go to the bottom of the text directions and select Save to My Maps. This will add the directions to your My Maps page (assuming you are logged into a google account). Go to My Maps and select the entry you just added. Click the edit button on the left. This will expose a View in Google Earth link on the top right of the map. Clicking this link will download a file that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>Directions to Scone, NSW</name>
<description><![CDATA[]]></description>
<NetworkLink>
<name>Directions to Scone, NSW</name>
<Link>
<href>http://maps.google.com/maps/ms?ie=UTF8&amp;hl=en&amp;vps=1&amp;jsv=262a&amp;oe=UTF8&amp;msa=0&amp;msid=109115301202341389527.00048cf92603b4141b1cf&amp;output=kml</href>
</Link>
</NetworkLink>
</Document>
</kml>
Replace all the escaped &
with &
in the URL in the href element and request the URL in the browser. This will give you the KML that you are after:
http://maps.google.com/maps/ms?ie=UTF8&hl=en&vps=1&jsv=262a&oe=UTF8&msa=0&msid=109115301202341389527.00048cf92603b4141b1cf&output=kml