How to keep the sitemap.xml automatically fine?

Hello,

if my domain is domain.com,
I put my html pages of the main site in / public_html /,
and I install a blog in / public_html / blog /.

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

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

I think to combine them in a sitemap.xml and send them to the search engine.
I find the article https://stackoverflow.com/questions/…e-sitemap-file,
You may need a sitemap.xml to combine the two sitemap files as follows:


http://domain.com/sitemap1.xml
2012


http://domain.com/blog/sitemap2.xml
2016-10-11

but you need the label ,
I want to ask if any script or method can update them automatically and update them in the main sitemap?
or It's not important ?