Maybe something like this will work. It sets a flag that tells the loops when to terminate.
set counter to 0
set exit_ to false
repeat until exit_ is true
repeat until exit_ is true
set counter to counter + 1
display dialog "Inner loop " & counter
if counter is 5 then set exit_ to true
end repeat
display dialog "Outer loop " & counter
end repeat