Rolling a cash-secured put
To avoid assignment on a short put , the roll here is “down and out.”
For example, let’s say you’ve sold a 30-day cash-secured put on stock XYZ with a strike price of $50. And let’s say you received $0.90 for the put when the stock was trading at $51. Now, close to expiration, the stock has dropped and it’s trading at $48.50.
The only way to avoid assignment for sure is to buy back the front-month 50-strike put before it is assigned, and cancel your obligation. The problem is, the front-month put you originally sold for $0.90 is now trading at $1.55. Here’s how you roll.
Using your broker's spread order screen, you enter a buy-to-close order for the front-month 50-strike put. In the same trade, you sell to open a back-month 47.50-strike put (rolling down), 90 days from expiration (rolling out) which is trading for $1.70. By doing this, you’ll receive a net credit of $0.15 ($1.70 back-month sale price - $1.55 front-month purchase price) or $15 total.

You were able to roll for a net credit even though the back-month put is further OTM because of the considerable increase in time value of the 90-day option.
If the 47.50-strike put expires worthless, when all is said and done in 90 days, you’ll net $1.05. Here’s the math: You lost a total of $0.65 on the front-month put ($1.55 paid to close - $0.90 received to open). However, you received a premium of $1.70 for the 47.50-strike put, so you netted $1.05 ($1.70 back month premium - $0.65 front-month loss) or $105 total (see Ex.2 above).
However, every time you roll down and out, you may be taking a loss on the front-month put. Furthermore, you have not secured any gains on the back-month put because the market still has time to move against you. And that means you could wind up compounding your losses.