*It is sunnah to praise ALLAAH before starting*
Surah Al-Hadid(57), Verse 1:
سَبَّحَ لِلَّهِ مَا فِي السَّمَاوَاتِ وَالْأَرْضِ وَهُوَ الْعَزِيزُ الْحَكِيمُ
Whatever is in the heavens and on earth,- let it declare the Praises and Glory of Allah: for He is the Exalted in Might, the Wise.
(English – Yusuf Ali)
It is permissible to buy & sell the mosque because the evidence of the hadith
The Prophet (ﷺ) came to Medina and ordered a mosque to be built and said, “O Bani Najjar! Suggest to me the price (of your land).” They said, “We do not want its price except from Allah” (i.e. they wished for a reward from Allah for giving up their land freely). So, the Prophet (ﷺ) ordered the graves of the pagans to be dug out and the land to be leveled, and the date-palm trees to be cut down. The cut datepalms were fixed in the direction of the Qibla of the mosque.
Sahih al-Bukhari 1868
From the above hadith prophet wanted to purchase the land for masajid from Banu Najjar. As land of masajid is property of masajid and prophet willed to purchase it. From this evidence it is permissible to buy & sell the masajid.
you should try to purchase another land with that money for purpose of masajid where there is high Muslim population. But you tried hard yet if you can’t find an area near to you which is Muslim population then
The best way to dispose the money raised from the sale of mosque if it not possible to replace it with other mosque, to distribute among the poor as ALLAAH said :
Surah At-Taubah(9), Verse 60:
إِنَّمَا الصَّدَقَاتُ لِلْفُقَرَاءِ وَالْمَسَاكِينِ وَالْعَامِلِينَ عَلَيْهَا وَالْمُؤَلَّفَةِ قُلُوبُهُمْ وَفِي الرِّقَابِ وَالْغَارِمِينَ وَفِي سَبِيلِ اللَّهِ وَابْنِ السَّبِيلِ فَرِيضَةً مِّنَ اللَّهِ وَاللَّهُ عَلِيمٌ حَكِيمٌ
As-Sadaqat (here it means Zakat) are only for the Fuqara’ (poor), and Al-Masakin (the poor) and those employed to collect (the funds); and for to attract the hearts of those who have been inclined (towards Islam); and to free the captives; and for those in debt; and for Allah’s Cause (i.e. for Mujahidun – those fighting in the holy wars), and for the wayfarer (a traveller who is cut off from everything); a duty imposed by Allah. And Allah is All-Knower, All-Wise.
(English – Mohsin Khan)
ALLAAH knows best