If you intend to offer the prayer of Maghrib and ‘Ishaa il-Aakherat in the mosque then you should follow the steps given below:
Dressed in the clean clothes for Namaaz, while entering the mosque you should say the du'a of Bismillaahe wa billaahe and send salaam to all who are present. While unfolding the masalla you should recite the du'a of Waqolil hamdo. If you happen to arrive early in the mosque then facing the qibla you should recite the Qur'an or do the Tasbeeh.
“Usalli salaat at- tatawwo'e arba'a raka'atil lillaahe azza wajalla adaa'an mustaqbelal ka'batil haraame Allaaho Akbar.”
“I am offering four rak'ats of Tatawwo' for the sake of Allah the Almighty, the Powerful, in the time facing the Holy Ka'bah, Allah is the greatest.”
It is highly commendable and praiseworthy to offer the prayer of Tasbeeh ul- Aazam after the naafelat. The topic has been dealt with in detail elsewhere. You can offer any prayer of naafelat or qazaa after ‘ishaa il-aakherat.