The following excerpt may shed some light in dealing with your temptation:
So long as we live in this world, we cannot remain without trial and temptation: as Job says, “Man’s life on earth is a warfare.” We must therefore be on guard against temptations, and watchful in prayer, that the Devil find no means of deceiving us; for he never rests, but prowls around seeking whom he may devour. No one is so perfect and holy that he is never tempted, and we can never be secure from temptation.
Although temptations are so troublesome and grievous, yet they are often profitable to us, for by them we are humbled, cleansed, and instructed. All the Saints endured many trials and temptations, and profited by them; but those who could not resist temptations became reprobate, and fell away. There is no Order so holy, nor place so secluded, where there are no troubles and temptations.
No man can be entirely free from temptation so long as he lives; for the source of temptation lies within our own nature, since we are born with an inclination towards evil. When one temptation or trial draws to a close, another takes its place; and we shall always have something to fight, for man has lost the blessing of original happiness. Many try to escape temptations, only to encounter them more fiercely, for no one can win victory by flight alone; it is only by patience and true humility that we can grow stronger than all our foes.
The man who only avoids the outward occasions of evil, but fails to uproot it in himself, will gain little advantage. Indeed, temptations will return upon him the sooner, and he will find himself in a worse state than before. Little by little and by patient endurance you will overcome them by God’s help, better than by your own violence and importunity. Seek regular advice in temptation, and never deal harshly with those who are tempted, but give them such encouragement as you would value yourself.
The beginning of all evil temptation is an unstable mind and lack of trust in God. Just as a ship without a helm is driven to and fro by the waves, so a careless man, who abandons his proper course, is tempted in countless ways. Fire tempers steel, and temptation the just man. We often do not know what we can bear, but temptation reveals our true nature. We need especially to be on our guard at the very onset of temptation, for then the Enemy may be more easily overcome, if he is not allowed to enter the gates of the mind: he must be repulsed at the threshold, as soon as he knocks. Thus the poet Ovid writes, “Resist at the beginning; the remedy may come too late.” For first there comes into the mind an evil thought: next, a vivid picture: then delight, and urge to evil, and finally consent. In this way the Enemy gradually gains complete mastery, when he is not resisted at first. And the longer a slothful man delays resistance, the weaker he becomes, and the stronger his enemy grows against him.
Some people undergo their heaviest temptations at the beginning of their conversion; some towards the end of their course; others are greatly troubled all their lives; while there are some whose temptations are but light. This is in accordance with the wisdom and justice of God’s ordinance, who weighs the condition and merits of every man, and disposes all things for the salvation of those whom He chooses.
We must not despair, therefore, when we are tempted, but earnestly pray God to grant us his help in every need. For, as Saint Paul says, “With the temptation, God will provide a way to overcome it, that we may be able to bear it.” So, let us humble ourselves under the hand of God, in every trial and trouble, for He will save and raise up the humble in Spirit. In all these trials, our progress is tested; in them great merit may be secured, and our virtue become evident. It is no great matter if we are devout and fervent when we have no troubles; but if we show patience in adversity, we can make great progress in virtue. Some are spared severe temptations, but are overcome in the lesser ones of every day, in order that they may be humble, and learn not to trust in themselves, but to recognize their frailty.
-The Imitation of Christ, Book 1, Chapter 13
Masturbation is tough to tame, and only by God’s grace can it be conquered. Take what you have accomplished, and mentally project them to the altar. Take the time to explain the difficulties to God. Persevere.