Yes, you can sell the car you borrowed. However, this must be done knowing some of the nuances. If you do it in a way that the law does not allow, then you can become a defendant in a criminal case. If you are going to do this, you first need to find a person who will be ready to buy this car from you. Then, after you do that, you will need to make a contract with that person.
Once you receive the money, you will pay off the loan ahead of time. After that, the new owner will get all the rights to your car. It is worth noting that selling a car on credit is a good option if you cannot repay the loan. However, you will not get back the money you have already spent, and if you have very little left to pay the total cost of the car, then there is no point in selling it.