Should Muslims vote for the "lesser of two evils" or abstain from voting when faced with a dilemma of choosing between two politicians who have both caused harm to Muslims and innocent people?
There isn't a single answer from shari'ah to this question.
Generally speaking, Muslims have a choice of whether or not to vote, and whom to vote for. Many Muslim leaders today encourage voting so that Muslims can also exert some influence over society and develop a stronger public identity rather than being an invisible group, and to try to direct society on a good course. However, as you point out, in some cases, there may be no good option.
In some cases, Muslim leaders such as maraji' may give direct guidance on voting.