I think you misunderstood the AGPS part - it needs to be done every time you need to get a first fix quickly, not just once. The data it uploads is valid for a limited time period. The persistent part is the 'AT+QGPSXTRA=1' setting which needs a modem restart to take effect if changed.
Also the script is very much proof-of-concept - if you're using it regularly you can streamline it by removing the checks that aren't acted on to save a few seconds of waiting for timeouts.
Also the script is very much proof-of-concept - if you're using it regularly you can streamline it by removing the checks that aren't acted on to save a few seconds of waiting for timeouts.