You should be able to reinstall macOS over top of itself by booting into Internet Recovery Mode using Command + Option + R which in theory should access the latest supported macOS online installer which for a 2011 laptop is macOS 10.13. If Internet Recovery Mode does not work, then try booting into macOS from the GRUB boot menu. If you can boot macOS this way, then you can create a bootable macOS USB installer.
See if the GRUB bootloader has a menu entry for booting into macOS. I have not used Ubuntu in many many years, so I'm not sure if Ubuntu even shows the GRUB menu anymore. I believe you should be able to press the "ESC" key before the Ubuntu logo is shown in order to access the GRUB menu. If macOS is not an option on the main menu, then select the "Advanced" menu and you should see an option for booting macOS.
If you cannot access the GRUB boot menu when booting Ubuntu, then you can try creating a bootable rEFInd USB stick and Option Booting the rEFInd USB stick to see if rEFInd can see macOS as bootable. There is a bootable rEFInd USB image available that can easily be used to make a bootable rEFInd USB stick.
https://www.rodsbooks.com/refind/
See the section "A USB flash drive image file" for creating a bootable rEFInd USB stick:
https://www.rodsbooks.com/refind/getting.html
Edit: Forgot to include a link to the Apple article for Internet Recovery Mode.