Repenting to Allah, seeking His Forgiveness, and returning ill-gotten money
If the reality is as you have mentioned, you have made a mistake and committed a grave sin. You have to
repent and seek the forgiveness of Allah (Exalted be He) and make serious attempts to search for the owner of the money. When you find him ask him to forgive you and give him the money. If you do not find him, look for any of his inheritors and give them the money. If you can not find his inheritors, give the money in charity intending to do so on behalf of the owner of the money. Then, if you find him or his inheritors at a later time tell them what happened. If they accept it, that is good. If they do not, give them the money and the reward of the charity will be for you. May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.