When you tried to install Ubuntu, it messed up your MBR portion of your GPT, which it mistakes for a full MBR like Windows.
https://en.wikipedia.org/wiki/GUID_Partition_Table
It also installs a Ubuntu swap folder in your EFI partition, which the machine tries to load into the ROMs I believe that that's likely responsible for your progress bar when you boot into Safe Mode.
You got to get that Ubuntu folder out of the EFI partition and that's no easy task, plus you go other things messed up.
Well you got your files off the machine, so your set to just erase the mess and get back to factory Lion.
Your going to need to make a Lion Recovery USB on someone else's Lion Mac using this software from Apple
Use a 1GB+ USB thumb drive, use Disk Utility to format it Partition Tab: 1 Partition, Option: GUID, format: OS X extended journaled and click Apply.
Next run this software, it will copy their Lion Recovery Partiton to your USB thumb drive
https://support.apple.com/kb/dl1433
Take it to your Mac, hold option and boot off the USB, use Disk Utility and select your entire physical hard drive, not just the indented Macintosh HD, you want the "500GB Toshiba 5934539583 media" that's on the far left.
Change the drive format under the Partition tab to 1 partition, Option: MBR, format MSDOS and click apply, (ensure you delete the old EFI partition) then
Erase Tab> Security Option Zero All Data, this will wipe off all data and check the drive for failing sectors, takes some time, so wait.
Format it under the Partition Tab: 1 partition, Option GUID, format OS X Extended journaled. (this is what Lion needs, new EFI partition created) give it the name MacIntosh HD and click Apply.
Quit Disk Utility and install the Lion Recovery Partition onto the internal drive.
Reboot the machine holding the command and r keys and enter the Lion Recovery, use your AppleID and password to download and install Lion into the Lion Macintosh HD
Once through Lion setup, install all your programs as you can, then last files from backup.
Good Luck 🙂