I assume you already know how to Extract the text from that element displayed in your screenshot, so I'm continuing from there.
This process will evaluate the 2 each time and only click the arrow once upon each valuation, then re-evaluate. That way it's > or < 0, not extra lines of code trying to decipher if the 2 are part of the same year or not.
Let's say that variable is %ElementText% and your next Loop date is a date variable set to %NextLoopDate%.
Also %NextLoopDate% should be on the 1st of the month in this case, if not, convert %NextLoopDate% to Month/01/Year so it can be compared equally against %ElementDate%
Label Click Arrows
Convert Text to Datetime %ElementText% custom format MMMM yyyy to %ElementDate%
If %NextLoopDate% > %ElementDate%
'click right arrow
GoTo Label Click Arrows 'this will basically loop us until %NextLoopDate% = %ElementDate%
Else(IF) %NextLoopDate% < %ElementDate%
'click left arrow
GoTo Label Click Arrows 'this will basically loop us until %NextLoopDate% = %ElementDate%
End(IF)
Good luck