I hope all is well.
If a needy family is given a loan to be repaid in one year but the family could not repay the loan after that year has passed, can the loan be forgiven and counted as zakat provided that the family is still zakatable?
بسم الله الرحمن الرحيم
In The Name Of Allah, The Most Gracious, The Most Merciful
The one in debt who is unable to pay off their debt is from the category of zakah eligibility.
It is not usually permitted to fulfil the zakah obligation by forgiving the debtor from their loan. However, the only exception to this is when you only own zakatable wealth as loaned out money and the amount of money owed to you is the only amount of zakatable wealth. As well as this, it would be required to cover the whole amount owed to you. In essence, it will be as though the full zakat owed cancels out the debt owed back you.
For example, if you were owed £1000 and the only zakah you owe is £1000 which is all in loans, then the debt can be forgiven as the fulfillment of zakah. It will need to cancel out the whole debt and not part of it, otherwise, it will not be permitted.
Only Allah knows best
Written by Alimah Nasima Umm Hamza
Checked and approved by Mufti Mohammed Tosir Miah
Darul Ifta Birmingham
 Al-Hidayah, Imran Nyazee Version, Page 334
 Raddul Muhtar, Volume 2, Page 170-171