I have two verbs in a sentence. I know I have to use 'to' before each verb. But in this case it sounds a little bit strange to me.
Should I use to there?
Test that this method returns right data and to works correctly.
Your sentence is grammatically incorrect as given. Without to and with an extra the, it is correct:
(The is needed with right data since right implies that there is only one acceptable set of data.)
I’m not sure why you would expect that to to be there.
In addition to the excellent answers already given, I wanted to make a pitch for using parallel structure. It has helped me figure out some otherwise tricky sentence constructions. In general, you want your verbs to match when they are associated using an and or an or. In your sentence:
the verbs that you want to match are "returns" and "works", because they are joined by the and. This would give you two alternatives:
Now since "returns" and "works" goes with "this method", the infinitive doesn't work here, so we're left with:
(@PLL is right about adding the "the" as well.)
As an example of how you might structure the sentence to use parallel infinitives, consider:
In this construction, "to see" and "to check" are coordinated with the and, so they should match. Matching with infinitives is less strict, though, because it is okay to drop the extra to:
Although personally, I think it is less clear this way.
This crib sheet has some other examples of parallelism, including other parts of speech.
Without really knowing what your example sentence is supposed to mean... I can tell you that "to works" is incorrect. It's either "to work" or "works".
You don't need the 'to' necessarily, but the sentence has errors beyond the 'to'.