Welcome to AutoIt and the forum!
You have to reset $j when you start the inner loop again:
WinActivate ("LMS — Mozilla Firefox")
Global $j = 0, $k = 0
Do
MouseClick("left", 415, 205, 1)
Sleep(2000)
$j = 0
Do
MouseClick("left", 1271, 858, 1)
Sleep(10000)
$j = $j + 1
Until $j = 2 ; Increase the value of $j until it equals the value of 2.
$k = $k + 1
Until $k = 2 ; Increase the value of $k until it equals the value of 2.
Exit