If someone owes days from previous Ramadans, he should make them up in order. So he should start by making up the earliest days, and doing it in order is obligatory according to the madhhab of Imam Ahmad.
It says in Kashshaf al-Qina` (2/308): If he fasted Sha`ban for three consecutive years (thinking that it was Ramadan), then realised that he had been fasting in Sha`ban (and not Ramadan) for three years, then he should fast for three months, with the intention of making up what he missed of Ramadans, one month after another, and he should intend it to be in the right order, like when making up missed prayers, meaning that it is obligatory to make up the prayers in order, and the same applies to the Ramadans that he missed. End quote.
The Permanent Committee issued a fatwa stating that it obligatory to do that in order. They were asked:
My mother has been suffering from kidney failure for nine years, and when Ramadan comes, she does dialysis, meaning that she goes to the hospital three times a week, on Saturdays, Mondays and Wednesdays. The way in which dialysis works is that there is a machine and two needles, and this comes under the heading of things that break a person’s fast if he is fasting. Nine Ramadans went by in nine years, and she did not fast on the days on which she did dialysis. When the month of Ramadan ends, she offers fidyah (feeding the poor) for the days on which she did not fast, and she does not make up these fasts, because she goes to the hospital three times every week. What should she do, even though nine Ramadans have gone by? Is there any sin on her, because she gave the fidyah for each day, and she did not make up the fasts? Please advise us, may Allah reward you with good.
Answer: If the matter is as described, she must make up the days on which she broke the fast in previous Ramadans, and the making up of the fasts should be done in order. So she should make up the days when she did not fast in the first Ramadan, then in the second, and so on, and she should feed poor persons for having delayed making up the fasts, feeding one poor person for each day. The amount to be given to each is 1.5 kg of wheat, rice, dates or other staple food of the local people, because of the general meaning of the verse in which Allah, may He be Exalted, says: {and whoever is ill or on a journey - then an equal number of other days} [Al-Baqarah 2:185].
And Allah is the source of strength. May Allah send blessings and peace upon our Prophet Muhammad and his family and companions.
Shaykh Bakr Abu Zayd, Shaykh Salih al-Fawzan, Shaykh `Abdullah ibn Ghadyan, Shaykh `Abd al-`Aziz ibn `Abdillah Al ash-Shaykh.
End quote from Fatawa al-Lajnah ad-Da’imah, Vol. 2, 9/105.
The Hanafis and the Malkis are of the view that it is not obligatory to make up the fasts in order.
It says in Tabyin al-Haqa’iq (6/220): If he has to make up two days from one Ramadan, and he fasts for a day and does not specify that it is for the first day, that is permissible. The same applies if these two days are from two different Ramadans, according to the correct view, and even if he intends to make up missed Ramadan fasts without further qualification, that is permissible. End quote from Fat-h al-Qadir. End quote.
It says in Minah al-Jalil (2/124): The one who has to make up missed fasts from two Ramadans should start with the first of them, but if he does them the other way round, that is fine. End quote.
Paying attention to doing them in order is more prudent, and it avoids doing something contrary to the view of the scholars who say that it is obligatory.
If he does not know the right order, or he has forgotten it, then there is no blame on him, and making it up is still valid.
Changing the intention after having done the act of worship does not count, so the fasts that you made up apply to last Ramadan.
In future, you should pay attention to the order in which you make up missed fasts.
And Allah knows best.