I want to run a python script that goes on infinitely, but it stops after I have closed the ssh terminal. I would also like to see the output from the script when I log in again.
There are several options to solve this. You could setup your Python script as a service. A pretty good tutorial can be found here.
Another option is to have the script simply launch on startup. A good tutorial to follow can be found here.
As for the output, I would suggest that you create a file and write your output to that file.
You can use
nohup yourCommand &
after that you can quit ssh and when you go in again, you can find the file
nohup.out that contains the output.
take a look here