The error is due to CentOS is already EOL and you need to update your repo so it points to the archived repo. You can do this by using the following sed command.
Once done, you should be able to do your yum update or dnf update.