Hello Masaprie44
I do understand your question.
Stay on board the 25222 train to Lugano and change there, as suggested by the itinerary.
Again: your ticket from Chiasso to Lucerne is also valid for the 25522 Trenord train, which is in fact a TILO train, a joint-venture by Trenord and SBB.
The tickets are split into Milan-Chiasso / Chiasso - Lucerne for VAT (tax) reasons. Swiss domestic tickets in combination with international tickets are exempt from VAT.
Does that make sense?
Your question has been asked many times before. You can find the same question when you use the search function of our SBB community and search for the keyword ‘Chiasso’.
Kind regards,
Roland