What can be done when you are faced with pains from your anus? Piains when going the defeacate and while walking because part of the flesh is outside

Seek help. These are common symptoms of many anorectal problems, often easily diagnosed / helped /dealt with in the doctor's office if they are experienced in anorectal issues. Hemorrhoids, fissures and fistulae come to mind with what you describe, all easily treated, often without surgery, so get help!