Hi @Saurabh 
First, I applaud your confession and honesty. You did something unwholesome, and you recognized that. You arenât shrugging it off or pretending what you did was alright. You have acknowledged your mistake as a mistake, and you have brought it up to others to learn how you can make amends and grow. When people would confess mistakes to the Buddha, he would tell them:
âIndeed you made a mistake. But since you have recognized your mistake for what it is, and have dealt with it properly, I accept it. For it is growth in the training of the Noble One to recognize a mistake for what it is, deal with it properly, and commit to restraint in the future.â
So you have grown already from that experience! Now, you have so many beautiful practices you can do to grow even more. Part of growing is learning from the mistakes we make. The first step is, as it says above, to commit to restraint in the future. If you commit not to do something like that again, the Buddha would have accepted your confession and moved on! 
Look at what you can do to prevent that situation from arising again. How can you change your mind states and habits so that if ants invade again, you will react non-violently? And how can you maybe rearrange things so everyone involved is less likely to end up in a harmful situation in the first place? Practice is not just cultivating good things or removing bad ones, but also preventing unarisen unwholesome things and growing the good that is already present.
Recognizing the unwholesome as unwholesome is wisdom. Committing to restraint is virtue. And of course, you can practice lots of mettÄ meditation to expand your mind and work on uprooting the reaction of anger so that it is unable to arise when a difficult situation presents itself. These reactions are conditioned, so given the conditions we have cultivated, our reactions will naturally follow. That is grounds both for forgiving ourselves and for diligence and heedfulness in guarding the mind so that it doesnât tend towards unwholesome action. Another thing that could be helpful to ease your mind and fortify your practice is to commit to taking the five precepts every day, reflecting on the wonderful benefits you and other beings receive from upholding ethical principles.
Itâs also important to forgive yourself. Once you recognize a mistake, make amends, and commit to restraint, then you donât need to wallow in it. Remember that emotions like self-hatred, guilt, etc. are unwholesome too and rooted in selfishness. Many people recognize the conceit of superiority and arrogance as unwholesome, but have arrogance in a different way: they think theyâre the best at being the worst, or that theyâre especially bad. Those are also unwholesome conceits; you donât need to entertain those thoughts. Whatâs done is done. Now you can do good things.
You can learn from mistakes. But you also can learn so much from doing good things in the present. That is all you can work on now, so that is all you need to concern yourself with. Rumination and guilt will only be limiting your ability to move forward. Even if you commit to maintain the principle of non-killing for one day, you can rejoice and recollect the wonderful deeds you are doing! So many people wouldnât take the precept at all! So donât take for granted how amazing the ethical commitments we make are! Youâre a great person if you feel that killing ants is a mistake and want to prevent yourself from doing it again.
You also shouldnât cultivate unhealthy fear or paranoia. Itâs good to recognize the danger of unwholesome action and not want to commit it. But we also have the reflection on equanimity: we will experience the results of our karma just like everyone else. We have committed so many good and bad actions in the past. At any moment, we might experience wonderful, pleasant things or horrible, painful things. But our response to a situation, with fear or aversion, or with equanimity and peace, is also creating karma. The correct karma is not to cultivate fear, but equanimity and balance. Accept that all you can do is make your heart pure and protect it from what is unskillful. With a pure heart, you will be able to face even difficult experiences with peace and calm.
By doing all of these things, you will be able to cultivate purity and fearlessness in the present, and your past deeds will not matter. It doesnât matter what the retribution would be, because what you need to worry about is your reactions, not the details of the experience! Ideally, you want to get to a place where your past bad deeds seem foreign, that you would naturally not commit them and recognize the unwholesome, but donât feel personal guilt. Donât worry, everything should be fine! Just do good. 
This is a long response, but I hope it is helpful. These types of situations are great opportunities to learn on a deeper level about virtue and forgiveness.