If a person enters dar al-harb with a promise of safety, it is not permissible for him to betray them with regard to their lives or their wealth
What you did by taking the money mentioned from the two banks, is a haraam action, because it was consuming people’s wealth unlawfully, and Allaah says (interpretation of the meaning):
“O you who believe! Eat not up your property among yourselves unjustly except it be a trade amongst you, by mutual consent”
Even if the owners of the bank are kuffaar, this does not make it permissible to take their wealth, because if the Muslim enters a kaafir land with a promise of safety, it is not permissible for him to betray them, and it is not permissible for him to harm them or take their wealth.
Al-Shaafa’i (may Allaah have mercy on him) said in al-Umm (4/263): If some Muslim people enter a kaafir land under a contract (of peace and safety), then the enemy should be safe from their harm until they leave, or until the contract expires, and the Muslims have no right to wrong them or betray them. End quote.
Al-Sarkhasi said in Sharh al-Siyar al-Kabeer (2/507): If a group of Muslims comes to a kaafir land and says, “We are the envoys of the caliph” and they produce a letter like that of the caliph, or do not do that, and that is a trick on their part to deceive the mushrikeen, and they allow them to enter, so they enter the kaafir land, it is not permissible for them to kill any of the kaafirs or to take any of their wealth, so long as they are in their land, because if what they said or showed to the kuffaar were true, then they would be safe and secure from the kuffaar and the kuffaar would be safe and secure from them, and is not permissible for them to wrong them in any way.
If they asked them for safety and they granted that to them, then they are obliged to be honest with them.
The same applies if they say: We have come with the intention of trade, but they aim is to kill some of them, because if they were really merchants as they claimed, it would not be permissible for them to betray the kuffaar. End quote.
It says in al-Hidaayah – which is published with Nasab al-Raayah (4/304): If a Muslim enters a kaafir land as a merchant, it is not permissible for him to transgress against anything of their wealth or their blood, because he has guaranteed not to transgress against them by asking them for safety, and transgressing against them after that is a treachery, and treachery is haraam unless the king of the kuffaar betrayed them and took their wealth or imprisoned them, or someone else did that with the knowledge of the king and the king did not stop him, because they are the ones who broke the treaty. This is different from the case of the Muslim prisoner, because he is not under their protection, so it is permissible for him to transgress against them even if they released him willingly. End quote
See also question no. 72384 and the fatwa of the Standing Committee quoted therein.
Based on the above, you have to return the money to its owners and not take the matter lightly, because one of the conditions of repentance is restoring the rights of those who have been wronged.
We ask Allaah to guide us and you.
And Allaah knows best.