i use a service file
/etc/systemd/system/myVpn.service
[Unit]
Description=My Vpn Connection
After=network.target
[Service]
Type=simple
Environment=password=correcthorsebatterystaple
ExecStart=/bin/sh -c 'echo YourPasswordHere | sudo openconnect --protocol=nc YourServerHere --user=YourUserHere --passwd-on-stdin'
Restart=always
systemctl enable myVpn
systemctl start myVpn