First check this page and see if your Mac can run Mavericks. Any machine that can run Mavericks can also run the new OS X release Yosemite, and you can just download and install that form the App Store.
If you can't run Yosemite, and want to update to Lion go here and purchase it, then Apple will email you a code you can use in the App Store to download Lion.
Either one you choose, the process is the same. You just select the product in the App Store application and it downloads and launches an installer that does the upgrade.
You should backup first just to be safe, but the upgrade will not erase your data.