I assume your VM instance is running Linux. If you want to start a command from an ssh connection, and you want it to continue after you logout, you can use the "nohup" (no hangup) command. For more information:
https://www.maketecheasier.com/nohup-and-uses
The more advanced way to do things is to simply provide a startup script when you launch the VM. The startup script can install python3.8 before it runs the command, and this provides more automation. For more information, see:
https://cloud.google.com/compute/docs/startupscript
An even more advanced way of doing things is to create an image which has your Linux system configured as you like it, with whatever packages you want installed, your programs installed, etc., and then set it up so that when the VM starts, it automatically runs the command. If this is something you are going to be doing a lot, it may be worth the effort to set up something like this. For more information:
https://cloud.google.com/compute/docs/images/create-delete-deprecate-private-images
If you want to see an example of how this can be automated, there are scripts which do all of this in the xfstests-bld github project. This is probably more complicated than your use case, but if you look at the scripts, there are a lot of great examples of how the whole process of creating VM images, and launching VM images, etc, can be completely automated. The whole point of this is so I can run a command like "gce-xfstests smoke", and this will automatically upload a freshly built Linux kernel from my source tree, and use that to test the file system code automatically, and then e-mail me back the results. Documentation of the entire project, and a slide deck presentation about it can be found here:
A quickie tour of some of the more interesting scripts in this system:
Perhaps this can give you some ideas!
Cheers,
-- Ted