Section 77. If property which has been attached and redeemed by the attaching creditor, as aforesaid, is sold on mesne process or on execution, the proceeds thereof, after deducting the charges of the sale, shall be first applied to repay to the attaching creditor the amount so paid by him, with interest.