A common mistake in Ramadan is to pray taraweeh with imam and pray witr at home
It is proven from the Messenger (blessings and peace of Allah be upon him) that he encouraged praying Taraweeh in congregation and he said: “Whoever stays with the imam until he leaves, (the reward of) qiyaam al-layl will be written for him.”
Narrated and classed as saheeh by al-Tirmidhi (806); also narrated by Abu Dawood (1375), al-Nasaa’i (1605), and Ibn Maajah (1327). Also classed as saheeh by al-Albaani in Saheeh al-Tirmidhi.
This reward will not be attained by anyone but the one who prays with the imam until he has finished all the prayers. The one who only prays some of the prayer and then leaves is not entitled to the reward promised in this hadeeth, which is that of spending a night in prayer (qiyaam laylah).