A Realtor (agent or broker) brings much more to the table than simply their license.
Even if we assume you will absorb all the knowledge and skill a realtor has (in order to help you price the home correctly, show it, work through negotiations, work through the closing, and so on), Realtors are also a gateway for buyers and sellers to gain access to networking tools - for instance, placing the home on an MLS (multiple listing service), which is how other agents will know it is for sale. That's not something you can just plug yourself into having passed an exam, you would need to either become an employee of a real estate agency, or start one yourself. No one will want to hire you for one sale, and starting an agency is adding a level of complexity and cost that will quickly rule out any advantage you may hope to gain. Effectively, you can't just choose to be a real estate agent on your own, completely independently, for one single deal without plugging yourself into the established "machine" that Realtors operate under.
And, to be blunt, the fact that you're asking such a basic thing calls into question your confidence in being able to pass the licensing exam, which is not trivial.
Homeowners who want to avoid paying a commission to an agent to help them sell their home typically choose to sell the home FSBO (For Sale By Owner). There are many resources on the web that would support you doing so if you google for them.
Of course, selling your current home FSBO doesn't mean you're incurring zero commission cost, since buyers will often bring their own agent into the deal, and they will want to include some sort of negotiation for paying them, since they're missing out on the typical commission arrangements. Even if that payment is not explicitly part of your sales contract, it is typically factored into the buyer's financial decision making (i.e. if they are paying it themselves).
Further, when you go to buy your new home, there is essentially no way for you, as a buyer, to force any random seller to abandon their selling agent (and hence their share of the commission). Even if you do succeed in becoming an agent yourself, you will likely not be able to avoid paying the seller's agent for your new home (and if you become an employee of an established agency, the agency is going to take a cut for your portion of the commission, so your "savings" will likely be closer to a quarter of the commission than half).