"I correctly exit from the inner while loop but afterwards it does not increment i"
Why do you assume this? The outer loop is not influenced by breaking the inner loop.
"counter2 never returns to 0 whenever "break" command is read..."
Of course the break command breaks the inner loop and does not reset counter2 to 0. But this reset is does, when the outer loop runs its next iteration.
As far as I can see, your assumptions are not correct. USe the debugger to step through your code line by line to see, what's going on.
Note that your inner loop does not increment j anywhere. Therefore the condition "while j <= length(F2)" does not seem to be correct.