What is the easiest way to convert KML generated layer to feature layer if there is any?
In the ArcToolbox there is Conversion Tools -> From KML -> KML to Layer, which is available at all licence levels.
Thanks appreciate it, but is there no way to do it as part of the code
Consider to use Open Source like QGIS.
Use FME from SAFE software
Or open the KML in ArcGIS and export it to the desired format.
Do you have multiple KML files or layers then consider FME or ModelBuilder or right click in Toolbox on the KML to Layer tool (Conversion Tools > From KML)
Esri doesn't publish their code, but as indicated if your dev language can access the tools in ArcToolbox, then you can do the conversion.
Also, you have posted in the top thread of the Developer Place...there are three main branches there so answers are best directed to one of those branches
GIS Developers or
so all answers will depend upon where you question should be.
Retrieving data ...