The virtue of catching up with the opening takbeer is not cancelled out by putting two prayers together in the mosque
Question

                I read a hadith of the Prophet (blessings and peace of Allah be upon him) which said that whoever prays for forty days, not missing the opening takbeer (with the imam), Allah will decree for him freedom from two things. I have tried to achieve that more than once until Allah made it easy for me, but one day the rain was very heavy, so we put Maghrib and ‘Isha’ together at the time of the earlier prayer. Did this spoil one of the forty days, or is it still valid? If it was the imam who was praying and trying to complete forty days, but he made a mistake in the prayer, does this mistake invalidate the forty days?
Praise be to Allah.At-Tirmidhi (241) narrated that Anas ibn Maalik (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) said: “Whoever prays to Allah for forty days in congregation, catching up with the first takbeer, he will be recorded as being free from two things: free from the Fire and free from hypocrisy.” This hadith was classed as da‘eef by at-Tirmidhi and a number of earlier scholars; they stated that the problem with it is that it is mursal. However, some later scholars classed it as hasan, including al-Albaani in Saheeh at-Tirmidhi.
See: Talkhees al-Habeer (2/27).
If the people in the mosque put two prayers together, that does not rule out a worshipper’s having caught up with the first takbeer. That applies whether the worshipper is leading the prayer as an imam or is praying behind an imam and made a mistake in his prayer. The bounty of Allah, may He be exalted, is immense and His generosity knows no bounds.
We ask Allah, may He be exalted, to help us and you to do more righteous deeds and acts of worship.
And Allah knows best.