Tests on sodium peroxoborate

When I prepare sodium perborate by mixing sodium hydroxide with metaborate (NaBO2) and hydrogen peroxide and cooling it I applied a test to it by acidifying it with HCl and adding KMnO4. A precipitate appeared and it turned black. What is the reason?

I tested another sample of sodium perborate by acidifying it with NH4Cl and after that KI and this turned white. Again, why?

-

In your first test, the $KMnO_4$ probably reacted with the $H_2O_2$ excess remaining after your preparation. The ionic equation for the reaction is
$\ce{2MnO4^- + 3H_2O_2 -> 2MnO_2 + 2H_2O +3O_2 + 2OH^-}$
The $MnO_2$ formed is an insoluble black precipitate. Although there is an $OH^-$, the reaction apparently occurs in neutral and faintly acidic medium as well.