How to combine all same metrics of a series of hosts into a custom graph in one go

Are you using the Enterprise Edition? If so, you can use combined Graphs which can be found under
image

if you have only the CRE, then this feature is not available.

You could try to build/edit the var/check_mk/web/<your_user_name>/user_custom_graphs.mk file by script. (not sure if there are REST-API calls available for this.)