How do I keep changes on whonix template

If I edit some things on a template of my whonix-gateway, after an update the changes are gone and I need to redo the whole thing. I can set up a script to run, but maybe there a better alternative?

Assume you have to do these changings rather on the whonix-gateway-17 app (sys-whonix) then on the dedicated template for the gateway…

I’m talking about changes within the OS itself. These needs to be done on the template, not the AppVM

And why doesn’t it preserve the changes after an update anyways?
Is this only for whonix template or for any templates?