Remove Ubuntu from a MacBook and put OS X back on
I bought a MacBook off eBay, thinking it would have OS X on it, but it didn't. It came with Ubuntu instead. I think it is a 2006 model or a 2007 model. I want to know how to put OS X back on it as I don't like Ubuntu.
This has nothing to do with Ubuntu or Linux. To remove an operating system, you just format the whole drive and install the new operating system over it.
If you are lucky, it's a dual boot computer. Hold the X Button while booting to boot into OSX if it is available. From there you can remove Ubuntu (to get help on this see https://apple.stackexchange.com/). If you still can not boot OSX, read further.
Since you bought a device, but apparently no license of OSX (you really got no disc?), you'll have to buy it somehow or use the help of a friend, as amanthethy wrote in his answer. This is an unusual case. Normally, the OS is preinstalled and it makes no sense to remove it, since if you buy a new device, the OS comes with it.
If you have no disc or USB drive of osx
Ask a friend with OSX to create you a copy (like amanthethy wrote) or buy it:
Here you can buy Snow Leopard, which is the oldest I found in the store. You can freely upgrade the OS if the device supports it. Make sure that your device is supported by this version of OSX first.
http://store.apple.com/us/product/MC573Z/A/mac-os-x-106-snow-leopard
How to install
To install the OS, just insert the disc, choose the disc tool in settings and format the whole drive. Then choose to install it. It's pretty straight forward.
For better help on OSX
Please note: The correct place to ask detailed osx questions is here:
https://apple.stackexchange.com/
Reinstall OS X Snow Leopard from the OS X Snow Leopard install disc. If you don't have one, you'll have to find someone who does and get them to lend it to you. I think Apple stopped making them (the discs) about 4 years ago.
If you can't get a copy of the Snow Leopard install disc, you can try installing a newer version of OS X USB. Google how to make a bootable OS X USB. You'll need a working Mac for this as you need to download the OS X install files from the Apple App Store and make the USB install stick with tools that run on OS X. Your MacBook may be too old to run the newer versions thought. You'll have to do some research on your own, bud (ie. Google "Can my MACMODEL# run OS X VERSIONYOUWANTTORUN").
This question isn't Ubuntu related. You won't find much more help than this here.
Unlike more modern Macs, the 2006/2007 models came with an installation CD/DVD so your best bet is to find a friend with a copy of OSX 10.4 Tiger, OSX 10.5, Leopard or OSX 10.6 Snow Leopard which is the latest system these models will run. You may find them on eBay or at a Mac store such as OWC Macsales. Once you have an installation disc, insert it into the MacBook's optical drive, reboot holding down the C key. When that's opened, select Disk Utility from the tools, and reformat and partition the drive, then the installation should be straightforward.