Lets take an example to explain this
Sodium(Na) has 1 electron in its outer or valence shell hence it will lose it and become a cation say to Chlorine(Cl)
To form Sodium Chloride.
Since it is capable of losing electrons, Sodium becoems a metal and has properties of metal
Whereas Chlorine which has 7 electrons in its valence shell gains an electrons to become an anion
Hence it is a non metal
And has the properties of an anion