By the first day of the next term of the court to which such replevy-bond and attachment shall have been returned, or afterwards, if longer time be granted by the court, the party who replevied the property shall file either a motion to quash the attachment proceedings or his declaration in replevin, if in the circuit court, or appear and prosecute his claim, if in a justice’s court, against the party in whose name or right the distress or seizure was made. Such party shall make defense, and if the attachment proceeding be quashed it may be amended. A tenant may file his declaration after a motion to quash shall have been denied, and the cause shall proceed to an issue and trial; and if upon trial it be found that the sum for rent or supplies was due, in whole or part, and that the distress was lawfully made, the landlord shall have judgment against the obligors in the replevy-bond for a return of the property replevied, or its value, to an amount sufficient to pay the sum found due, with interest and costs of suit. If the property replevied be restored, it shall be sold to satisfy the judgment, and if it be not sufficient, execution shall go against the party replevying for the residue.