Section 27. If the court finds the plaintiff entitled to redeem, it shall determine the amount due on the mortgage or what condition the plaintiff is bound to perform for the redemption of the land, and shall enter judgment that, upon payment of such amount or performance of such condition within such time as it shall order, the plaintiff shall have execution for possession of the land and shall hold it discharged of the mortgage.