All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
If your intention behind improving your voice while reciting the Quran was to benefit the person who was listening to you and not to impress him to praise you for your good voice, for example, this is not considered Riya’ (Showing-off). It was authentically narrated that the Prophet, sallallaahu 'alayhi wa sallam, listened to the recitation of Abu Musa Al-Ash`ari who was known for his good voice.
However, if your intention behind improving your voice was to be praised by the person you mentioned, this is considered Riya’, but you will not be considered sinful because you are excused due to ignorance, as you did not commit Riya’ intentionally. Allah, the Almighty, says: {Allah does not impose blame upon you for what is unintentional in your oaths, but He imposes blame upon you for what your hearts have earned. And Allah is Forgiving and Forbearing.} [Quran 2: 225]
As for your prayer, it is valid and you are not required to repeat it.
Allah knows best.