What they said, and then some. Pain, like pleasure, triggers the brain to produce and release all kinds of interesting chemicals to help you cope with it, including dopamine*. Now, you’re already addicted to the dopaminergic high produced by masturbation; do you think becoming addicted to the dopaminergic high produced by self-inflicted pain is going to make the first addiction go away? Far from it; it will probably make it worse, and the devil you’re fighting will have two prongs against you instead of one.
I, too, was addicted to masturbation and pornography for nineteen years, so I know where you’re coming from. As tassitus quoted from the Catechism, “Self-mastery is a long and exacting work.” For you, for now, it is not so much about hating masturbation or the pleasurable release it brings as learning to love Christ more. In the last year before I managed to learn a modicum of self-control I turned to praying the Chaplet of the Divine Mercy at least once and often twice a day, making frequent acts of contrition, begging Mary’s intercession through prayer and other small acts of self-denial, and begging for chastity, as St. Augustine would have it, begging to understand and love chastity. Until you love chastity more than that fleeting moment of satiation, you will have a tough fight every day. But what you will learn in the course of fighting, and in the course of getting yourself trounced regularly, will be determination and humility - a sense of how often and how completely you must rely on God and His Mercy.
Two other things I should mention to round out this post: 1) Appropriate counseling is almost mandatory for “getting over” any sort of addiction, and 2) prayer also produces a dopaminergic response, so turning to God in prayer really is the most practical help in moments of crises. And the third thing I almost forgot to mention: if this really is chronic masturbation, see a physician: chronic masturbation can seriously harm your physical health.
*Yes, my references to dopamine are an intentional simplification of very complex chemical responses, but they get the point across.