Building an html file from the db?

could someone point me in the right direction with this?

I am looking to create a physical HTML file from the database and
FTP that file.

Think FTP’ing a file to a website to update a page for CMS purposes.

but first I need to build/create an html file from the DB - what would
this look like from a code perspective?

I am thinking at least the first step isnt far off from what scaffold