You are quite right that antidepressants tend to cause weight gain.
The reason for doing so is not completely understood, but doctors think that it could be related to the better mood of the patient on these medications. When the patients feel better and get well, they eat better, makes sense?
Nonetheless, not all antidepressants are the same. The one that you mentioned like sertraline, actually is one of the ones that are "weight neutral", or one of the ones that causes the least weight gain.
If you are concerned, you should speak to your doctor about the medication you are on.
You should start exercising as well and watch your diet to combat.