Script to change VPN server address

Hi there

I am looking for a script to change the server address of a VPN.
we have a dynamic ip and every time the ip changes we need to change the server address of the VPN connection.
We have a script that copies the new ip to a txt file.
I need a script to copy this new ip into the VPN settings as the new server address.

All the scripts I have found create the VPN connection from scratch but I only need to make one change to an existing connection.