You will need to take the S10, which is direct, and goes every hour. See sbb-tickets.cc for schedules. The train does change line numbers from S10 to S50 in Mendrisio, but you can just stay put. Just make sure you board the right part in Lugano (as the other half continues as S10 till Como…)
Your pass is valid till the border. You will need a ticket for the remainder. Easiest is to just buy that at the ticket office in the station. You can do that the day before if you want.