Can I take melatonin while on hydrochlorothiazide, toprol xl, cozaar, zocor, and zoloft?

No additional risk. You are on a lot of medication and they seem important - but do review them w/ your Dr(s) and always do when a new one is added. The melatonin adds no risk to the mix but some there already can cause moderate issues that ought not stop you but should be watched. Best wishes!