If the client device performs 3 DH key exchanges with the 3 Tor relay devices, how does Tor provide anonymity to the client; wouldn't the IP address of the client be seen during the key exchange?? How does Tor prevent this??
The client only directly talks to the entry node. It talks to the second node through the entry node, and to the third node through the second node. Only the entry node knows the client's IP. The entry node does not know the third node or the final destination that the client is communicating through Tor with.
DH key exchange is totally unrelated to the IP hiding mechanism - it's for point to point privacy. The IP is hidden because when the 3-layer tunnel is built - the "onion" - it is built one layer through another, so the third chain member will not be able to see your IP because you will talk to it through a second chain member you're talking to through the first one. That's how the IP address is hidden - and DH is totally out of relation with the hiding technics applied.