When sufficient cause shall be shown for the arrest of a defendant as aforesaid such court, judge or clerk shall make an order directing the defendant to be arrested and held to bail for such sum as the said court, judge or clerk shall think fit, and the plaintiff shall thereupon deliver to the clerk of the court in which the action is pending a bond in a penalty double the amount sworn to, executed by himself or some person for him with one or more sufficient securities, approved by the clerk, to the effect that the plaintiff will pay the defendant all damages he may sustain by reason of the arrest, should it thereafter appear that the order was wrongfully obtained.