The Fair Labor Standards Act (FLSA) prohibits deductions from employee pay for cash shortages, unless the shortage results from theft or misappropriation.
On the other hand, an employer may write-up employees for any reason it chooses, and a Texas employer may generally fire an employee for any reason (at-will employment).
In your situation, there is no way to avoid being written-up if there is a shortage. Further, if there is a shortage that leads to your termination, you cannot successfully sue for being terminated.
However, if you refuse to make up the shortage and the employer deducts it from your pay, they are violating the FLSA. Further, if the employer deducts it from your paycheck, then you challenge the deduction, and the employer terminates you, you may have a retaliation claim.