A waqf does not become binding by merely forming the intention
Question

There is someone who acted as a guarantor for a loan to buy a house next to the mosque, to be added to the mosque (as a facility belonging to the mosque). Then after that, this man put this house in his name, instead of putting it in the name of the mosque. What should be done now? Who is the rightful owner of this house? Does it belong to the mosque or to the man?
Praise be to Allah.A waqf does not become binding by merely forming the intention that something should be a waqf. Rather he has to utter words to that effect, such as saying, “This is a waqf”, or do an action to indicate that it is a waqf, such as if he builds a place then gives the call to prayer (adhan) in it, which indicates that he is giving it as a waqf to be a mosque.
It says in al-Mawsoo‘ah al-Fiqhiyyah (44/119-120)
The fuqaha’ differed concerning how binding it is when something is designated as a waqf, and if it can be retracted. The majority of Maliki, Shaafa‘i and Hanbali fuqaha’, as well as Yoosuf and Muhammad among the Hanafis, are of the view that once a waqf is given by someone who has the authority to dispose of wealth and fulfils all the necessary conditions, then it becomes binding and cannot be retracted, and the one who made it a waqf no longer has any authority over the property given as a waqf in any way that undermines the purpose for which it was made a waqf. So it cannot be sold, given as a gift or inherited. That is because the Prophet (blessings and peace of Allah be upon him) said to ‘Umar ibn al-Khattab (may Allah be pleased with him): “Give it in charity as a waqf, not to be sold or given as a gift or inherited.” Because the waqf is a donation that prevents it from being sold, given away for inherited, it immediately becomes binding (and cannot be retracted) as soon as the donor utters words to that effect – as in the case of manumission of a slave. It is unlike giving a gift, because giving a gift means transferring ownership completely, whereas in the case of a waqf, the property itself is kept, but the benefit is given away as charity. Hence it is more akin to manumission and it is more appropriate to draw an analogy with it.
According to Abu Haneefah, if someone makes a waqf, it is permissible to retract it and it is not binding for ever. He may retract it within his lifetime, although that is makrooh, and it may be inherited from him. … But the view that became the official Hanafi view is based on the view of Abu Yoosuf and Muhammad, which is that it is binding and cannot be retracted. Ibn ‘Aabideen said, quoting from al-Fath: The correct view is the view of the majority of scholars, that it is binding and cannot be retracted, because there are many hadiths and reports to that effect. That was the view followed by the Sahaabah and Taabi‘een and those who followed them, and their view is more likely to be correct. End quote.
Ibn Qudamah (may Allah have mercy on him) said:
Ownership ceases and the waqf becomes binding (and cannot be retracted) as soon as words to that effect are uttered, because the waqf takes effect as soon as the words are spoken. There is another report from Ahmad (may Allah have mercy on him), according to which it does not become binding unless it is received by the caretaker and the donor hands it over.… Then he quoted evidence for the validity of the first view, then he said: We have proof in what we have narrated of the hadith of ‘Umar, because it is a donation that disallows selling, giving away and inheriting, so it becomes binding by merely uttering the words, as in the case of manumission. This is in contrast to giving a gift, because giving transfers ownership in full, whereas in the case of a waqf, the original property is kept, and the benefit is given to specific recipients. Hence it is more akin to manumission and it is more appropriate to draw an analogy with it."(al-Mughni  6/ 208)
Based on that:
If the owner of the house merely had the intention (and no more) of making the house a waqf for the sake of Allah, may He be exalted, to be attached to the mosque, then he is not obliged to go ahead with that; rather he may retract his intention. But if he clearly stated that it was a waqf after buying the house, and he said: “It is a waqf for the sake of Allah, may He be exalted,” then in that case it is not permissible to retract it. Rather he must go ahead and make it a waqf as he said, and if he promised the people of the mosque that he would make the house a waqf for the sake of Allah, may He be exalted, to be attached to the mosque, then it is better for him to fulfil his promise, for that is one of the most sublime of Muslim characteristics.
The scholars of the Standing Committee for Issuing Fatwas were asked:
His Excellency Prince ‘Abd ar-Rahmaan ibn ‘Abdullah Aal Sa‘ud promised to give a piece of land near the village of ad-Dubay‘ah to build a school, but doing that depends on whether it is permissible to go back on a previous promise to give it to build an Eid prayer place.
 His Excellency asked us to consult the scholars concerning that, and whether he should choose to give it to build an Eid prayer place, in fulfilment of the previous promise, or to give it to the Ministry of Education to build a school on it? Please note that there is already a mosque for Eid prayer in the west of ad-Dubay‘ah.
They replied:
If His Excellency Prince ‘Abd ar-Rahmaan ibn ‘Abdullah Aal Sa‘ud has already given the piece of land to build an Eid prayer place on it, then it is to be used to build an Eid prayer place, and he has no right to retract his gift. If what happened was merely a promise to give the land to build the mosque on it, then it is better for him to fulfil his promise. End quote.
Shaykh ‘Abd al-‘Azeez ibn Baaz, Shaykh ‘Abd ar-Razaaq ‘Afeefi, Shaykh ‘Abdullah ibn Ghadyaan
Fatawa al-Lajnah ad-Daa’imah (16/93, 94)
See also the answer to question no. 125101
And Allah knows best.