I’m going crazy trying to figure this out- Vpn status with logs

I’m struggling to make a simple automation work. I want a background task on both my iPad and iPhone that checks my Proton VPN connection every five minutes. Since Proton VPN already provides a native action that vhevks they status and provides a yes or no response, I just need the output to trigger. If the VPN is connected, nothing happens. If not, I get a notification and the VPN attempts to reconnect using snother native proton specific action. I also want a log of every five-minute check. This log should record the connection status at the time and date in 24-hour format, indicating whether it’s connected or not. Each five-minute interval should be noted, and the log should be appended to a master log file. At the end of 24 hours a new log file is created. I’ve tried everything I can think of, but I can’t seem to get it working. I’m at my wits’ end and would really appreciate your help.