Wisdom is in learning from mistakes of others. That’s why Allah (SWT) has mentioned stories of people of the past so we can learn from them and not repeat their mistake.
So a scholar once mentioned the story of a brother who was a good practicing Muslim. The community knew him for his goodness. He used to regularly pray at the masjid. But he had problem with attaining khushu so he thought maybe it is because of the people in the congregation. He decided to solve the problem by praying at home instead. So he stopped coming to the masjid and started praying in his house.
However he couldn’t attain khushu even at home so he decided he’ll pray inside the room and lock the door for complete peace and quite. He did that but unfortunately even that didn’t help. So he decided he’ll turn the light off also but that too didn’t help.
Ultimately he thought to himself that if my salah doesn’t have khushu then why pray at all? My prayer is useless. So he stopped praying.
Quran (29:45) Recite, [O Muhammad], what has been revealed to you of the Book and establish prayer. Indeed, prayer prohibits immorality and wrongdoing, and the remembrance of Allah is greater. And Allah knows that which you do.
Once a person abandons prayer, he becomes a playground for shaitan. Many months later the Imam met him somewhere outside and asked him I haven’t seen you in the masjid for a while. Where have you been?
He replied, “I’ve left Islam”.
May Allah help us stick to our prayer and stay connected to the masjid.