The quotation, which may not in fact be a quotation from the Scripture, could have come from a non-biblical source that was familiar to à Kempis.
Otherwise, it suggests to me a conflation of several biblical concepts such as we find in Matthew 5:4, 6:6, and 6:12.
"Blessed are those who mourn, for they shall be comforted."
"But you, when you pray, go into your inner room, close your door and pray to your Father who is in secret, and your Father who sees what is done in secret will reward you."
"And forgive us our debts, as we also have forgiven our debtors."
Put them all together, and you have the substance of à Kempis' quotation. I suggest the following paraphrase of the quotation:
"If you want to experience true heart-sorrow, go into your private prayer closet where only God can see and hear you and where the din of the outside world is silenced; repent of and mourn for your sins; and receive the gift of forgiveness in proportion to your willingness to forgive others who may have sinned against you."