Instance template resources are immutable in GCP. You can edit/change the managed instance groups only by creating a new instance template.
Once you add the new template to the managed instance group either using the console or you can do it in gcloud by executing this command:
gcloud compute instance-groups managed set-instance-template \ --template= \ [--region=REGION | --zone=ZONE] [GLOBAL-FLAG …]
Now, all the instances that are to be created after adding this template, will follow the rules in instance template. But, this addition of instance template will not affect the existing instances in the group i.e the instances that use the old instance template. You need to recreate those instances by typing the following command in gcloud:
gcloud compute instance-groups managed recreate-instances \ --instances \ [--region=REGION | --zone=ZONE] [GLOBAL-FLAG …]