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 is His slave and Messenger.
It is permissible to keep money as an endowment in a way that the capital money is kept as an endowment and its profit is spent on any charitable field that is endowed for.
If you can transfer this endowed money to another bank that will make a Mudhaarabah (which is an Islamic term that means that a person gives an amount of money to another person in order to trade with it and the second takes a share in the profit, like one-fourth, or half, or a third and the like) with it, and gives a higher percentage of profits than the first bank, then this is permissible. Rather, it is an obligation to do so for the benefit of the endowment.
A person who makes an endowment should work tawards the benefit of the endowment, and if he finds someone who makes a Mudhaarabah with the endowed money better than the first person, then he should give the money to him when the contract with the first person comes to an end.
Allaah Knows best.