Section 40. The debtor shall in his complaint offer to pay the amount found due for redemption and may set forth any tender he has made. The court shall determine the amount due, unless it has been already ascertained under section thirty-four, and shall require the debtor, within such time as it may order, to deposit with the clerk for the use of the creditor or purchaser the amount due for redemption. Upon the debtor's complying with the order, he shall be entitled to judgment and execution for seisin of the land.