Instead of copying to configuration in enable prompt, copy the configuration in the global configuration mode.
When creating a configuration file, you must list commands logically so that the system can respond appropriately. To accomplish this, perform these steps:
For more information, refer to the Creating a Configuration File By Using a Text Editor section of Working with the IOS File System, Configuration Files, and Software Images.
After reloading the switch, if the old password is not accepted, a password recovery is necessary on the switch.
For more information, refer to Password Recovery Procedures, and select the appropriate device type.