Hi and welcome to the forum! I am glad that I can help you.
You would like to know the cause of bleeding while passing stool through the anus.
There are several conditions that can cause bleeding in the stool. There are two types of bleeding in the stool, first from the upper part of the digestive canal and the other from the lower part of the digestive canal. When bleeding from the upper part of the digestive system, the blood is digested and the color of the stool from the normal brown to yellow, turns to black. In bleeding from the lower part of the digestive system there is visible blood mixed with or sprinkled over the stool. Causes of bleeding in the upper part of the digestive system are ulcers or esophageal varices. Causes of bleeding in the lower part of the digestive system are infections, invagination, hemorrhoids, fistulas and fissures. Constipation occurs commonly as a result of the diet. Pushing when defecating may cause hemorrhoids or fissures.
Given the data that you described, you may be experiencing pain and bleeding while passing stool through the anus due to fissures. You may consider changing your diet by consuming more liquid-like meals like soups, tea or coffee (these two are stimulants and activate the peristalsis), and to consume less chocolate or bananas. You should defecate regularly when you feel the need to. Avoid pushing while defecating to prevent fissures and hemorrhoids.
Please keep in mind that I provide medical information only. I am not able to diagnose medical conditions online. Please contact your doctor for further advice and information about treatment of your current condition.