Hello and thank you for writing to us. I am glad t hear things are going well for you! Each of the antidepressant medications like Zoloft has their own properties/side effects. One of the primary (most common) properties / side effects of Zoloft is drowsiness so it is recommended you take it at night. Hopefully that helps with some of your sleep difficulties as well so ou can transition of the melatonin without any major problems.
I totally understand - sleep is hugely important. One of the problems with these types of medications is their side effects can be a bit unpredictable and it can take some trial and error to figure out what time of day is ideal to take the medication and at what dose. Usually, once you have been on the medication for long enough, your body gets used to it enough where the side effects are barely noticeable at all. So try not to worry. Follow your doctors lead on taking the med as they know you and you situation best. And if you try that for a few days and aren't feeling great, try taking it at night for a few days and see if that helps. You could also try lunch time and see if that feels like the right time for you. But refrain from overthinking or stressing about it. Zoloft is a very popular drug, primarily because of it's high tolerability and low side effects so hopefully, it will keep working for you without wreaking havoc on your sleep (which would be fairly unlikely at a pretty low dose like 100mg).