If you have six windows open, then you're going to have to rely on clicking at a position—how else could KM figure out which of the six windows you want it to activate? Even if you did something fancy to figure out which window is offset to the left/right of the current one, at some point, you're going to have to have KM activate that window either by name or mouse click.
And given that the names will be constantly changing (I would assume), then your best bet is to click in the window, and it should be very reliable, assuming that the "opposite" window is frontmost.
Here's a proof of concept using TextEdit. With two side-by-side windows open, and one of them frontmost, the macro will switch to the other via a click in the toolbar area of each window. There are probably much more efficient ways of doing this, but this method seems to work.
But are the two you want to switch between the frontmost two windows of your app? If so, you just need to activate the window with index 2 -- that will make it the frontmost (index 1) and your previous frontmost becomes index 2, ready for the next time you want to switch.