The data you are using in the code block is DriveSummary. It doesn’t contain distances or gps data and therefore cannot be used to calculate total distances. You probably want to use LocationDetails section of the file. It’s the most valuable part of the data because it contains all the gps goodies. Put that into a .gpx and use tool like Garmin BaseCamp to read it in. BaseCamp is the software I use and had in mind when I started writing the script. BaseCamp can be downloaded for free from Garmin web site: https://www.garmin.com/en-US/shop/downloads/basecamp
BasCamp can calculate distances from gps data points:
It can also calculate total distance of multiple tracks:
BaseCamp can overlay tracks on a map and it comes with very rough world base map. Usually it’s enough to give you general overview where you have been but more detailed maps are also available.