Domain Name Server and Domain transfer
Normally what happens when you purchase a domain from one Vendor say Amazon, you will link the domain to you web hosting account.
But later you may stop using amazon hosting service but you find some other vendor for hosting. Say you go for squarebrothers.
In that case you will be having two options, either set your name servers to point them to your square brothers vps hosting account.
Let me briefly explain how exactly these domain names works
Assume that you purchased a domain knowledge.com in amazon. It looks like below
Which means amazon has dedicated three name servers to map your domain knowledge.com to system specific ip address. Everything in internet works with ip address, knowledge.com domain will be mapped to specific ip address but to translate an ip to human readable domain name name servers are required.
now your domain mapped to name servers of amazon, these name servers will be allocated for you when you purchase hosting account.
If you purchase an account in square brothers, they will provide few name servers for you, to map the domain knowledge.com which is there in amazon, you just need to set name servers of square brothers hosting account in amazon domain control panel.
Assume that square brothers have given ns.sqrbr.server1 and ns.sqrbr.server2 as name servers, set these to in amazon by replacing name servers given in the above fig.
This is just mapping domain name, in case if you want to transfer completely from one account to another you just need to disable privacy protection and theft protection in the closing account, and apply for domain transfer.