Will Allah accept my prayer if my heart is impure and if not do I have to redo it
The fact that you have come to pray is proof in itself that you have purity in heart.
If it is the Iman or Taqwa that you think is missing in your heart then, I recommend you to keep up with the 5 times salah and inshaAllah your iman and Taqwa will also keep up.
Allah says as per hadith Muslim 6833:
Whoever comes to me walking, I will come running towards him.
Also in quran says in 2:186
And if My servants ask you about Me, I am near answering the calls of those who call to Me. So let them respond to Me and believe in Me that they may be guided.
So, the fact that you are praying means you still have purity in heart and Allah still responds.