All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His Slave and Messenger.
Possessing the given thing is a prerequisite for the validity of the gift. Ibn Abi Zayd Al-Qayrawaani, a Maaliki scholar, said: "No gift, charity, or endowment is valid without possession. If a person given a gift does not accept it, he clearly does not possess it." Accordingly, the money you collected for your friend still belongs to those who paid it. Should you receive it, hand it over to them by any means possible. However, if you cannot do this, because you forgot them, as you mentioned, or do not know their whereabouts, you may in this case give the money as charity on their behalf. If it happens later that they, or some of them, come to you, they shall have one of two choices: either to accept that you gave their money as charity and expect the reward; or to take their money back and yours is the reward of charity. With regard to the amounts paid by each one of them, try your best to identify them.
That said, you should not have done what you did with the money paid by other people. You should have told them that the man did not accept the money as a gift and discussed with them the option to give it to him as a debt; had they accepted, the debt would have been written down for documentation.