Which WSN attacks can be protected by Key exchange+encryption

I am thinking of a simple key exchange method in a WSN. For exchanging the key I am using AES encryption. What are the WSN attacks this method can protect the WSN from? I have tried to know more about attacks and their prevention but can't figure out which attacks can one simple key exchange using encryption protect a device from. Thank you for your time.

For exchanging the key I am using AES encryption.

You're using AES encryption on an Arduino? Interesting, what library are you using? How do you exchange the keys for the AES encryption (AES is symmetrical).

I have tried to know more about attacks and their prevention but can't figure out which attacks can one simple key exchange using encryption protect a device from.

The key exchange itself doesn't protect from any attack. What are you using the keys for?