I found this library, very useful, but I couldn't find how to create the file.
There is a post related to how to create Word documents:
Several have asked how to create a KML file (or KMZ if compressed) starting from a map generated with the GMap library.
A KMZ specification is not simply a compressed KML file, but it can also contain other files, such as marker images if they are customized.
I started from a precious example...
UPDATE 2020-05-19: Please use this library instead
The attached class will help you in creating basic sql statements for CRUD functionality using BANanoSQL.
We feature CREATE, UPDATE, UPDATE & DELETE statements, we also have added, creating a table. Whilst this class will work...