Why did Devaki keep having children even though she knew they'd all be killed except for the last one?
It must have been hard for a mom to see her newborn baby being killed- but she still continued to have more kids.
According to the Devībhāgavatapurāṇa & Harivaṁśa, these 6 infants were known as the Ṣaṛagarbha. They were initially born as the mind-born sons of ṛṣi Marīci, but were cursed by Prajāpati Brahmā to be born as asuras after they mocked Him for harboring carnal desires towards His own daughter Sandhyā under the influence of Kāma. So, they were born as sons of Kālanemi. In that birth, they propitiated Brahmā & from Him, obtained the boon of being invincible to devas, asuras, humans, ṛṣis, nāgās, gandharvas, yakṣas, beasts & weapons. Hiranyākṣaśipu, who had also obtained a same boon of sorts, became insecure on learning about this. He feared that the Ṣaṛagarbha might turn against him after this, so he cursed them to be killed immediately after birth on their next birth by he who was their father at that birth i.e Kālanemi & for his own security, consigned them to deep sleep. On the command of Bhagavāna Viṣṇu, Devī Yoganidrā extracted the souls of the Ṣaṛagarbha from Pātāla & placed them into the womb of Devakī. And as per the curse of Hiranyākṣaśipu, they were killed immediately after birth by Kaṁsa, who was actually the reincarnation of Kālanemi.
After the deaths of her only 2 sons Hiranyākṣa & Hiranyākṣaśipu, Diti was understandably griefstruck. At this time, according to the Matsyapurāṇa, on the advice of ṛṣi Vaśiṣṭha, Diti propitiated Bhagavāna Viṣṇu through the observance of Madanadvādaśī vrata with the aim to obtain a son who would subdue Indra. When Diti became pregnant again after completing the vrata, Indra became insecure. So, on one occasion when Diti fell asleep without washing her feet, Indra entered inside Diti's body through her nostrils & when he failed to destroy the foetus, he cut it into 7 pieces. On being cut, the foetus created a loud howling noise. Indra said 'Mā ruda' (i.e Don't cry) & silenced them by cutting each piece into 7 pieces, making a total of 49 pieces. Diti's husband, the ṛṣi Kaśyapa converted these 49 pieces into the 49 Maruts (named after the appellation given by Indra), the stormy winds who accompany Indra & are controlled by Rudra. According to the Devībhāgavatapurāṇa, it was actually Indra's mother Aditi, insecure & jealous of her co-wife's unborn child, who directed Indra to attempt aborting the foetus inside Diti's womb. So Diti cursed Aditi to bear the grief of losing her own 7 newborn children. That curse was fulfilled when Aditi reincarnated as Devakī & bore the deaths of her 6 newborn babies shortly after their births & the supposed abortion of her 7th child.
So we have
Now the question arises
By now, it is clear that all this was pre-destined. All sources state that Kaṁsa was initially planning to kill Devakī but Vasudeva managed to save Devakī's life in exchange of her children. According to the Devībhāgavatapurāṇa, when Vasudeva voluntarily came forward to surrender their 1st child, Kaṁsa did actually spared that infant, stating that he sought only the 8th child. But ṛṣi Nārada put forward a chicanerous argument - the term 8th child didn't necessarily meant that it must be the 8th one in order of birth, it could be anyone among Devakī's children in any order (merit, physical strength, height etc). He also fed Kaṁsa's insecurity by stating that monarchs well-versed in the art of politics & statecraft shouldn't spare even the weakest of their enemies, because that spared enemy might grow so strong in future that he can't be subdued like before (take for example the Taliban in our times). The fact that Kaṁsa acted upon such an illogical argument indicate his own cruel disposition.
A counter-argument is - Vasudeva could have just not impregnated Devaki again after the death of their 1st/7th child. Our answer - The term 'Devaki's 8th child' didn't necessarily meant that all of them must be sired by Devakī's legitimate husband. Since the prophecy referred to Devaki's 8th child, it was clear that nothing could prevent Devaki from conceiving atleast 8 times. So it's better to have all the 8 children fathered by Devakī's legitimate husband than to allow somebody else do it. When carnal desire hits hard, it is practically impossible for ordinary people to resist its pangs. Pāṇdu indulged in sex with Mādrī inspite of being well-aware of the curse placed upon him. When people who can't even afford the basic salt to season their parboiled rice (as they say in Bengali - নুন আনতে পান্তা ফুরোয়) will not leave the chance of begetting children, then what to say of others.
So in short - whatever happened was due to destiny.