(OK. This man came for a witness [‘as a witness’? – is ‘testimonium’ a person (a witness) or is it ‘testimony’ as in the next part of the sentence? – and how does ‘in’ function here?] / to give testimony of [regarding] the light / that all men might believe through him)

John 1.8:

non erat ille lux / sed ut testimonium perhiberet de lumine. /

(he was not the light / but in order – as a witness?? – that he might present testimony concerning the light...)

This last sentence seems quite chaotic... 'He was not ... but that he might present ...' ??? / as testimony/witness that he might ...??? I don’t get it.

Of course, I get the underlying esthetic/rhetorical structure, but how does that crazy syntax work?

I think "venire in testimonium" might just be a phrase that means "to come in testimony," generally "to come as evidence/proof." So He presented himself as proof [of God's glory, etc.] so that everyone..."

John 1.8:

non erat ille lux / sed ut testimonium perhiberet de lumine. /

Here I don't think testimonium is the trouble, but an assumed word. Perhaps "Non erat ille lux, sed [erat] ut testimonium perhiberet de lumine." He was/existed so that he could give proof. Erat, vivebat, existebat... It's uncommon to see a result "ut" clause with a verb of "esse" in the independent clause, but that's theology I guess.

"testimonium" in "in testimonium" is accusative. So I guess this preposition "in" means "to the direction of" or "for the purpose of". There is an aim, goal, purpose (=testimonium) and "he came" to that direction.