Salt, even marine salt, is never needed in a freshwater tank, even a molly tank. The fact that mollies can not only survive but thrive in a purely salt water tank, like a reef tank for instance, does not make it necessary in their water. Many fish, but not all by any means, will be harmed by salt in their water.
Mollies are a special case. They are what is called euryhaline which means that they are very adaptable to a huge range of mineral content in their water. Some reef keepers, yep straight salt water, use mollies to cycle their salt water tanks at full reef concentrations of marine salt. In that setting the mollies not only thrive but breed and produce lots of fry. As long as you give them a few hours to adjust gradually, pet shop mollies can move freely from pure fresh water settings to pure salt water settings and back again with no damage. Pet shop mollies have wild ancestors that live in the mouth of rivers and streams and can find themselves in pure ocean water or pure river water very quickly. Because of that, that have developed the ability to adapt between the water types quickly. There are few other fish in the aquarium trade with that ability.
Mollies, and a few other fish, tolerate salt well and do like to have rather high mineral contents in their water. If you have very soft water with almost no mineral content, then salt can be a shortcut way to raise the mineral content. A better solution for those fish, that will not harm most other fish, is to add some nice calcium carbonate to the filter flow path and let it dissolve very slowly in your tank water. Calcium carbonate is most often seen as crushed shell or crushed coral in an aquarium. If you find that you have very pure water with almost no dissolved minerals in it, go to the fish shop and buy a small amount of the white looking substrate that they sell for salt water tanks. It is mostly crushed shell or crushed coral, as you will be able to tell by examining it closely. A small amount in the main filter flow path will slowly dissolve and raise both the pH and mineral content of your tank water. If you do this, stick with small, no more than maybe 30% water changes. Otherwise you may see some osmotic shock from sudden large changes in that mineral content. Fish care very little about pH but they can be harmed by rapid changes in dissolved mineral content.