Connect the printer to your Mac using the USB cable.
Turn on the printer, turn on the Mac.
Connect your Mac to your router via cable.
Open System Preferences> Printers & Scanners
if the printer does not show in the left hand panel
click on the + button and add your printer.
Click on Default Printer and select your printer.
This should force the Mac to connect to HPs servers and
download the relevant software for the printer.
If that does not work then click on the link below,
https://support.hp.com/gb-en/drivers/selfservice/hp-officejet-pro-8020-all-in-one-printer-series/24208622
Make sure the operating system selector is set for Mac OS X 10.11
Click on the + button to reveal the download available for your printer.
Click on download, once it has downloaded double-click to install.