how to properly maintain the sitemap.xml automatically?


if my domain is,
I put my main site html pages under / public_html /,
and I'm setting up a blog at / public_html / blog /.

for my main site, sometimes,
I can manually update or download new pages.

and my blog,
I can write a new message every day.

I think to merge them into a sitemap.xml and send them to the search engine.
I find the article…e-sitemap-file,
I may need a sitemap.xml to merge the two sitemap files as follows:

but you have to tag it ,
I want to ask if a script or method can automatically update and update them in the main site map?
or is not important?