The startup script can be added through the console after creating an instance.
Navigate to the VM instance page and select the instance(By clicking on instance name).
Scroll down to custom data, Where you need to edit that field and add the key to startup-script and add the script in the value field.
Restart the instance to get these configurations, updated. Thus you can add the startup-script to the VM in google cloud.