Praise be to Allah.Praise be to Allaah.
If the situation is as you describe then you did something bad and committed a great sin. You have to repent and seek forgiveness, and you have to try hard to look for the owner of the money. If you find him, then ask his pardon and give him the money. If you cannot find him then look for his heir and give him the money. If you cannot find his heir, then give the money in charity with the intention that the reward should go to the owner. If you find the owner or his heir after that, then tell him what happened; if he approves, all well and good, otherwise give him what is his due, then you will have the reward for the money given in charity.
And Allaah is the Source of strength.