If one has stolen something, then one should return the stolen stuff to the owner, even if one has to send the stuff by mail without giving his name. In addition, one is permitted to give the equivalent amount of the stolen stuff to charity if the specific owner is not known.
Dr. Sano Koutoub Moustapha, professor of fiqh and its principles, International Islamic University, Malaysia, states: If you have some of those items you took, you need to return them to their owners. (If a stolen item is lost or damaged, one has to compensate the owner for it.) You should find the best way of returning them so as to avoid anything that might put you in a difficult or shameful situation.
Do seek, directly or indirectly, the forgiveness of your victims, as the Prophet (peace and blessings be upon him) is reported to have said: “The repentant from sins is like a sinless person.” In other words, the repentance would clear you from your sins with the condition that you don’t repeat the same sin and you do good deeds and seek the forgiveness of Allah all the time.