You buy a ticket when you get on, which from Cathedral to Leppings Lane will be around £2 or so, like someone says the realistic option is to buy a day saver for £4. This way you can ride every tram and bus around Sheffield as many times as you like to your hearts content for the mere sum of £4...