Hopefully you'll pop back and read this. Unfortunately, you've made a couple of basic errors - but don't feel too bad, you're not the first, and you won't be the last.
Firstly, you need to understand the nitrogen cycle. In a nutshell, fish produce ammonia as a waste product. This is toxic. If left, the fish will poison themselves. In your filter, and on your gravel, a colonies of bacteria will grow which feed on that ammonia, and turn it into another substance called nitrite. This is also toxic. So, another set of bacteria will grow, which will turn the nitrite into nitrate. This isn't toxic in low quantities, and you control it, by reguarly changing water.
Your fish died because it was poisoned by its own ammonia. Your tank has not had a chance to grow those bacteria colonies. The reason the fish stuck to the filter was because it was dying. Healthy fish don't get stuck to the filter, yours did so because it was too weak to swim away.
The second error was that mollies are too big for a 10gallon tank. They produce a lot of ammonia, and the concentration built up quickly because it's a small tank.
What you should have done is to regularly monitor the ammonia and nitrite levels, at least daily, and in your case probably twice-daily, and then changed enough water to keep those two toxins down to negligible levels.
Now that you have an empty tank, you can do what's called a fishless cycle. This entails adding bottled ammonia to simulate fish, it allows the bacteria to grow without poisoning any fish. Once you've got that underway, we can advise you on fish that you would like that are suitable for a small tank like yours.