I am doing a project on viduy and want to know its origin
There are two types of Viduy. The first is a step in the process of repentance. This is recorded in the Torah in Vayikra 26:40, and cited by the Rambam as a Mitzvah at the start of Hilchos Teshuvah, and ibid. 2:7.
The second is part of the process of offering an atonement offering, a Korban Chatas Asham or Olah. The sinner is bidden to declare his sin while placing his hands on the head of the animal he will be offering as a sacrifice, immediately before the animal's slaughter. This is recorded in the Rambam Hilchos Ma'aseh ha'Korbanos 3:14-15.