How to safely edit samba config files?

i did some testing, and i think that is incorrect advice.
after each reboot, whatever changes are made are LOST
if i edit smb.conf.template4, then reboot, the router updates smb.conf


again, i think is incorrect advise, in the forum, there are many examples of changing the samba config.
sure, a router firmware update or luci, could/will overwrite the changes, but that is to be expected.

———-
i did more research i found several topics from gl-inet staff editing the samba config file.

you need to edit /etc/samba/smb.conf.template

sed -i 's/smb encrypt = required/smb encrypt = auto/g' /etc/samba/smb.conf.template4
reboot

please, i just want confirmation, should i edit smb.conf.template4 or what?
thanks much, david