Shaikh Ibn ul-‘Uthaymeen rahimahullah said:
“As for the one who exits from the masjid then returns soon, then he does not pray tahiyyatul Masjid because he did not leave with a leaving that is interrupted. So like this it was not reported from the Messenge(ﷺ) that when he exited to go to his house for a need and he was in ‘Itikaaf then returned that he prayed two rakat. Also, this exiting is not considered exiting by the evidence that it does not break the Itikaaf of the one in Itikaaf. If his exiting is considered separating from the masjid, then his itikaaf would be broken. So like this, if a person exited from the masjid with an intention not to return except for the following obligatory prayer, then after taking some steps he returns to speak to another person even after half a minute, then this one prays two rakat because he left with the intention of leaving that is interrupted/suspended”
[Majmoo al-Fatawa wa Rasaail (14/352)]
The Permanent Committee gave a similar ruling. They were asked:
Question: If the muadhin for the Fajr prayer prays Tahiyyatul-Masjid then leaves in order to awake the employees for the prayer, does he have to repeat the Tahiyyatul-Masjid when he returns to the masjid?
Answer: “Whoever’s exiting of the masjid is repetitive, like the one who calls the prayer or the custodian of the masjid, then it is not necessary for them to repeat the Tahiyyatul masjid every time”
Faisal Ibn Abdul Qaadir Ibn Hassan