Praise be to Allah.
What you have done is a grave evil, a major sin and a repulsive shameful deed. The fact that it happened in Ramadan makes its sinfulness even more serious. What you must do is repent to Allah, may He be exalted, and make up that day, as well as offering expiation.
Ibn Qudaamah (may Allah have mercy on him) said: The expiation (kafaarah) becomes a binding obligation upon one who has intercourse in the front or back passage in Ramadan deliberately, whether he ejaculates or not, according to the view of the majority of scholars.
Then he said: It makes no difference whether it is in the front or back passage, of a male or female. This was stated by ash-Shaafa‘i.
End quote from al-Mughni (3/60).
See also: al-Mawsoo‘ah al-Fiqhiyyah (35/55).
The expiation is to free a slave. If that is not possible, then he must fast for two consecutive months. If he cannot do that, then he must feed sixty poor persons. It is not permissible to choose the option of feeding the poor for one who is able to fast, according to the majority of fuqaha’.
The evidence for that is the report narrated by al-Bukhaari (1936)from Abu Hurayrah (may Allah be pleased with him) who said: Whilst we were sitting with the Prophet (peace and blessings of Allah be upon him), a man came to him and said: O Messenger of Allah, I am doomed! He said: “What is the matter with you?” He said: I had intercourse with my wife whilst I was fasting. The Messenger of Allah (peace and blessings of Allah be upon him) asked: “Can you afford to free a slave?” He said: No. He said: “Are you able to fast for two consecutive months?” He said: No. He said: “Can you afford to feed sixty poor persons?” he said: No. The Prophet (blessings and peace of Allah be upon him) paused for a while, and whilst we were like that, a large basket of dates was brought to the Prophet (blessings and peace of Allah be upon him). He said: “Where is the one who was asking?” The man said: I am here. He said: “Take it and give it in charity.” The man said: To someone poorer than me, O Messenger of Allah? By Allah, there is no family between the two lava fields [i.e., in Madinah] who is poorer than my family. The Prophet (blessings and peace of Allah be upon him) smiled so broadly that his eye-teeth became visible, then he said: “Feed your family with it.”
Masturbation – which is the deliberate emission of maniy – is haraam; the prohibition is more emphatic if it is done whilst fasting, because it renders the fast invalid. But the one who does that does not have to offer expiation according to the view of ash-Shaafa‘i and Ahmad, as has been explained previously in question no. 71213.
Masturbation also interrupts the sequence of fasts being observed consecutively; this also applies to anyone who deliberately breaks the fast without a valid excuse.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said: If he breaks the fast due to a valid excuse which makes it permissible for him to do so, such as sickness or travel, then this does not interrupt the sequence of fasts being observed consecutively. If it so happens that this man who started to fast two consecutive months – whether it is expiation for zihaar [a jaahili form of divorce in which a man says to his wife, you are to me as my mother’s back], or expiation for having intercourse during the day in Ramadan, or expiation for murder – travels and breaks the fast, that does not interrupt the sequence of his consecutive fasts, because travelling makes it permissible to break the fast. But if he uses travel as a trick or loophole to let him break the fast, we say to him: It is not permissible for you to do that, and you must continue with your fast, because obligatory duties cannot be waived by means of tricks and loopholes, and if you do that [and break your fast] you must start the two-month fast all over again.
End quote from ash-Sharh al-Mumti‘ (13/273).
With regard to what you said about not breaking the fast the second time, it does not make sense, because masturbation breaks the fast.
Hence you must fast for a further two consecutive months, as well as repent to Allah, may He be exalted, from the shameful deed and from masturbation.
Please understand that the gate of repentance is open, and that Allah, may He be exalted, rejoices over the repentance of His slave and forgives sins, no matter how great they are.
So think positively of Allah, turn to Him, humble yourself before Him, beseech Him in your supplication [du‘aa’], and ask Him to purify your heart and divert evil and shameful deeds from you, and to make you one of His righteous slaves.
And Allah knows best.