Both translations are correct, but they have slightly different meanings.
"I waited 4 years" means that you waited a total of 4 years, without specifying whether it was continuous or not.
"I waited for 4 years" specifically indicates that the waiting occurred over a period of 4 years. So the second translation, "я ждал на протяжении 4 лет," is more accurate if you want to convey the idea that you were waiting continuously over a period of 4 years.
Both translations are correct, but they have slightly different meanings.
"I waited 4 years" means that you waited a total of 4 years, without specifying whether it was continuous or not.
"I waited for 4 years" specifically indicates that the waiting occurred over a period of 4 years. So the second translation, "я ждал на протяжении 4 лет," is more accurate if you want to convey the idea that you were waiting continuously over a period of 4 years.