The ruling on a testimonial is based on its purpose. If the purpose is Mubah (permissible), there is no harm in it, if it is done according to lawful procedures. However, if it is used for a purpose that is Haram (prohibited), such as getting a loan from a bank with interest, a Visa card that involves Riba (usury), and so on, it is not permissible to give a testimonial, as it would involve cooperating in sin and transgression. Allah (Exalted be He) says (what means):
...but do not help one another in sin and transgression. And fear Allâh. Verily, Allâh is Severe in punishment.
(Part No. 14; Page No. 194) May Allah grant us success. May peace and blessings be upon our Prophet Muhammad, his family, and Companions.