Hi Giuseppe,
You can load any KML files, as long as it is hosted on a HTTPS and CORS enabled website.
You could also create a local KML and then load it, but that only works if you are using the
map.geo.admin.ch UI to add it to the map (and access your local files through the browser dedicated API).
So if your goal is to generate content on-demand for your website, creating and hosting the KML on your own website might be the best solution. You can then show it through our embedded view, if you want to minimize the amount of UI elements on the map.
Cheers,
Pascal