Sec. 16. If the defendant or other person representing the defendant, at any time before judgment, executes a written undertaking to the plaintiff with sufficient surety, to be approved by the court, clerk, or sheriff, to the effect that the defendant will:
(1) appear in the action; and
(2) perform the judgment of the court;
the attachment shall be discharged and restitution made of any property taken under the attachment or the proceeds of the property.