Ok with the external drive connected, boot your mac up. Now open Disk Utilities (Applications/Utilities)
Select your internal drive in the left column, make sure you select the Disk not the indented Volume.
Click on Erase, give the Disk a name, at Format select Mac OS Extended (Journaled) and at Scheme
select GUID Partition Map, click on Erase. Once finished your internal disk should now be okay to install an OS on.
Quit Disk Utility.
Click on this following link, How to upgrade to macOS Sierra - Apple Support
go to Section 4 and click on Download macOS Sierra.
This downloads InstallOS.dmg to your Downloads folder.
When downloaded open to InstallOS.pkg, double-click on
that and an installation window will open, this does not install Sierra
but converts the .pkg to the Install macOS Sierra.app which you will find in
your Applications folder, it should be 5.04GBs in size.
To start the installation of Sierra double click on the Install macOS Sierra.app.
The copy of the install app self deletes after installing Sierra, so make sure you keep a copy of the InstallOS.dmg
if you need it in future, or you could just make a copy of the Install macOS.app prior to installing and moving it to
an external drive for safe keeping. It is also possible to create a bootable USB installer disk, using the Install macOS Sierra.app
in the Applications folder, and the createinstallmedia command in the Terminal app. Read the instructions here,
How to create a bootable installer for macOS – Apple Support
The download of Sierra was released in October 2019, after the previous installers certificates expired, so this is an updated version. When it was first released there was a problem with it, it would not create a bootable USB installer. I am not sure if
Apple has bothered itself to rectify this, but try it any way.
Your mac can install High Sierra and you can download it from here,
How to upgrade to macOS High Sierra - Apple Support
At Section 4 click on Get macOS High Sierra, this downloads Install macOS High Sierra.app
directly to your Applications folder. The installer is about 5.23GBs.
If you do not want to install High Sierra you could install El Capitan, it downloads the same way as Sierra so use the
above instructions for Sierra above. How to upgrade to OS X El Capitan – Apple Support