It is to teach some rules that refer to the use of witnesses when there are more than two witnesses present. For example, Babylonian Talmud: Tractate Sanhedrin Folio 9a
And just as in the case of two witnesses, if one is found to be a near
kinsman or otherwise disqualified4 person, the whole testimony is
rendered void, so in the case of three witnesses, the disqualification
of one invalidates the whole evidence. And whence do we infer that
this law would apply even if the number of witnesses reached a
hundred? — We infer it from the repetition of the word witnesses.
The talmud explains that the group of witnesses is treated as a single unit and once they appear before the court, a disqualified witness will invalidate the entire testimony.
Art Scroll Sanhedrin 9a note 8 says
If three witnesses are discredited through hazamah (see 8b note 2)
they are all punished equally, even though the court could have ruled
on the strength of the testimony of the first two witnesses alone
The verse states By the word of two witnesses or three witnesses,
where it would have sufficed to say , two or three witnesses. The
repetition of the word witnesses teaches that all groups of
witnesses, whatever their size, are treated equally.
An example of such a case is found in Business halacha Weekly
“Asher is your cousin?” asked Yankel.
“Yes, our fathers are brothers,” said Yitzi.
“If so, he is disqualified from testifying,” said Yankel. “A first
cousin is considered a close relative. I’m not paying” (C.M. 33:2).
“Leave him out,” said Asher. “There are still two witnesses, Reuven
and Shimon, who are not relatives. Isn’t that enough?”
“It is not,” answered Rabbi Dayan. “The Mishnah (Makkos 5b) teaches
that if one witness in a group is found to be a relative or otherwise
disqualified from testifying, the entire testimony is void. This is
similar to the saying ‘One rotten apple spoils the whole bunch.’”
“Rebbi and Rav Yossi dispute whether this rule applies also to
monetary issues,” continued Rabbi Dayan. “The accepted halachah is in
accordance with Rebbi that it applies also to monetary testimony”
“Then how can anybody ever testify?” asked Asher. “In many instances
relatives are present!”
“A relative disqualifies others only if he intended to serve as a
witness with them,” replied Rabbi Dayan. “However, if he saw the event
but had no intent to serve as a witness, he does not void the
testimony of the other qualified witnesses. Furthermore, while the
Rambam, Shulchan Aruch and Shach (36:8) maintain that the relative
voids through intent alone, Tosafos and the Rema maintain that he
voids the other witnesses only if he actually came and testified.”