Can't reinstall OS on MacBook after erase
I've been trying to erase the data on my 2016 MacBook Pro to sell on. It was running Big Sur, so I erased the hard drive, and then it prompted me to reinstall Big Sur which I tried, and this failed.
When I started through Recovery, it then gave me the option to install Sierra, not Big Sur. This then failed also. There is an error message - "an error occurred while preparing the installation. try running this application again."
Several retries have resulted in no success.
Opening disk utility, I have run first aid on the Macintosh HD partition, however the top level section, entitled 'AppleAPFSMedia' won't run first aid, and comes up with an error. It says I must run first aid via recovery to fix this, but I am in recovery mode, so not sure how I can fix whatever the issue is.
At the top level, the whole disk bar is blue, and then the lower section, Apple SSD media, says 'unformatted'
In disk utility there is no option to format the disk as APFS, even though the top level disk has this title. I don't know whether something strange has happened as it is trying to roll back to the original OS, but it was on Big Sur.
Any ideas how I can fix this? It is frustrating as the Mac was working perfectly fine, all I needed to do was just remove data and do a fresh install.