First, you have to remove the link between your Nintendo Account and your current Nintendo Network ID under "Linked Accounts" after signing into your Nintendo Account.
If you sign in using the sign-in data of a Nintendo Network ID, you have to create new sign-in data before disabling the link. This can be done by linking your Nintendo Account to a different external account or by adding a password to your Nintendo Account. To add a password, go to "Password" in the menu after signing in.
Then you have to sign out from your Nintendo Network ID.
After that, you can return to the Nintendo Account settings and link your Nintendo Account to another Nintendo Network ID from "Linked Accounts".