The old email that was an Apple ID say example2@yahoo.com but is a rescue mail , you don't remember the password of rescue mail address , you have signed in with new apple id say example1@gmail.com in mac and you try to change password using rescue mail , the rescue mail can't be accessed ( due to incorrect credentials ) or possible that old Apple ID and rescue mail address were same .
The rescue mail address is always added in the Apple ID account , sign in with Apple ID account , if it's not yet added create a web mail account say with gmail service https://support.google.com/accounts/answer/27441?hl=en
Make sure this mail address and password should be totally different than your Apple ID address / password see the section of rescue mail address in this article https://support.apple.com/en-in/HT201356 in the same Mac open a new tab ( press command and T keys ) sign in with your gmail account here in the web mail account you will see this code , come to the old tab in which apple id account is already opened , fill up the code in the fields and click on done to save .