Thank you for your inquiry.
The Swiss Travel Pass (or other swiss tickets) are only valid on the Swiss rail network. If you travel through Germany, an additional ticket must be purchased.
I would be happy to make an example for you, travel day 14 July 2022 from Basel to Stein am Rhein:
Departure 10.02, arrival 12.22. You travel via Zurich HB and Winterthur. This track is in Switzerland and is valid with the swiss tickets.
Departure 10:34, arrival 12:42. You travel via Basel Bad Bf and Schaffhausen - but through Germany. An additional ticket must be purchased for the Basel Bad to Schaffhausen route.
If you have any further questions, please do not hesitate to contact us.
Have a nice day. Kind regards