When you write "For each VPN gateway in the subnet" it is better to indicate how to find the VPN gateway in the subnet.
In my code, I found the relevant VPN gateway with resource-group id.
cmd = f"ibmcloud is vpn-gateways --resource-group-id {resource_group_id} --output json"
Delete all VPN gateways in the subnet, if any
To list all VPN gateways in your account, run the following command:
ibmcloud is vpn-gateways
For each VPN gateway in the subnet you want like to delete, run the following command, where $vpnid is the ID of the VPN gateway.