Praise be to Allah.
If the first mosque for which the money was collected has been completed and does not need the extra money, it can be used to build extra facilities for other mosques, such as libraries, washrooms, etc, as has been stated by the scholars in the book Al-Waqf, because this is in the same category as the mosque for which people donated money and it is known that the donors’ aim was only to help furnish one of the houses of Allaah. So whatever is left over can be spent on a similar project. If there is no mosque that needs the money, it can be spent on providing other things that serve the Muslims’ interests, such as schools, outposts, charity to the poor and so on. And Allaah is the source of strength.