After having a full erection and then it goes back to its smaller size, there is a discharge of thick mucus like fluid, which is obviously not sperm. What is it? Is it normal to get that? (I wasn't masturbating.)
If the fluid coming out is clear, then all you are seeing is the fluid from the Cowper's glands, called pre-ejaculate fluid.
Since you say it isn't semen, I assume that the fluid is whitish or some other color. If so, then the most likely cause is a urinary tract infection. When you have a strong erection, the Cowper's glands start secreting fluid to flush out the urinary tract. Either the glands are infected, making the fluid thick when it shouldn't be, or you have an infection elsewhere and the fluid is pushing it toward the end of your penis. When your erection fades, the pus from the infection dribbles out of the end.
You need to see a doctor soon. As embarrassing as it may be, if you have an infection, you need antibiotics to combat it. Even if nothing in particular hurts or is uncomfortable, an infection can cause permanent damage if it is not treated. Likely, the doctor will want a small sample of what is coming out of your penis to culture and look at under a microscope. This will tell him what kind of infection you have and what antibiotics will most effectively kill it off.