How to reinstall macOS?
Boot your Mac holding down the Command and r keys. This should get you into Recovery Mode.

First get into disk Utility and delete the Ubuntu partition and format it as macOS Journaled HFS+. Once that is done quit out of disk utility and click on Reinstall MacOS.

It will connect to your network via WiFi (so if you can do ethernet, it will go faster) asking you for your WiFi password and proceed to install the version of macOS that your Mac came with.

Once macOS is installed you can log into the mac and then into the App Store and pick a later version of macOS that you want on your Mac if the one that was installed is not as up to date as you like.