Terminal Speedtest Script MacOS
Background: I am having problems with my internet connection and the ISP call centre guy refusing to see a problem.

This is key to understanding your problem question.  What is the problem exactly that you’re are experiencing?  Going into detail here will help you (help us) come up with a solution that addresses your exact problem.
From your question, it seems that you are attempting to utilize (at least) two tools to determine what the issue is.  The problem is, neither tool is sufficient to get you accurate metrics to help you diagnose the perceived problem.
Ping
Ping measures how fast your network adapter responds to a request (a.k.a. Latency).   The problem with this is that you can have lightening fast latency (i.e. 10ms), but horrible bandwidth (56Kpbs) to transfer your files.
Where ping will come in handy is monitoring this latency over time assuming latency is the issue you're experiencing.
Bandwidth
You may have and pay for a high speed connection from your ISP, but what happens outside your ISP’s network could be the issue here.  See the post Improve file transfer performance over VPN for more details on this.  Basically, if the tech at your ISP is measuring data transfer rates from the ISP to your site it may be working fine (which is all the ISP is responsible for).
It’s entirely possible a server on a different network has a low bandwidth connection is creating the issues you are experiencing.