Macbook Pro 2009 15” Recovery mode non existant os x 10.5.8
If you have another mac, donwload High Sierra, which is the newest version compatible with 2009 iMacs, create a bootable disk and follow Apple's instructions on how to reinstall macOS.

https://support.apple.com/en-us/HT208969