Your zakah will not be valid in this way. The scholars of Fiqh have written two ways for paying zakah. First, when you calculate your wealth, you should separate the amount of zakah with the intention of Zakah and then give it to the poor. Secondly, when you give it to the poor you should make the intention of Zakah. Therefore, you should receive your amount from the Madrasa and then pay it as Zakah.
Allah (Subhana Wa Ta’ala) knows Best
Darul Uloom Deoband