I assume you are talking about quitting at the company that is training you for your CDL after getting your CDL and then paying them back for the training.
Sure you can do that.
The question is, "what are the consequences of quitting after getting your CDL?"
(If I have guessed correctly about what you are asking about, lol)
We don't know the detailed answer of that question. For the answer you need to read the contract that you signed for the training.
It will state the consequences. For many trucking companies it is not favorable to do so. Might be a penalty, as much worse if you don't actually pay them soon. It might cost a lot more than training elsewhere too.
For other companies, they don't really trip too much. You pay them back. Look for another job.
It's almost always better to complete the terms of the contract though.
Here is a page that I put together for drivers to read prior to making a final decision about whether to quit their trucking jobs. Especially right after CDL training.