To buy a domain name all you need to do is go to a domain registrar and search for a domain name. Once you find the web address you want to purchase, check it off and proceed to the checkout. Most domain registrars let you pay by either credit card or paypal. You can also pay by check at some domain registrar websites.
Once you purchase a URL, you can then login to your account and navigate through your domain manager. You can then change options and settings on your domain name, the most important of which are your DNS servers. Your DNS servers will look like NS1.websitename.com and NS2.websitename.com. You will change these to your webhosting DNS servers so you can host your website under your domain name.