Multiple loops in set intervals with code in between

As stated by the codex, have_posts starts, steps through or rests the loop. check codex here.
In your code, when entering the second or n-th while, the posts loop is already started, so it steps to the next post, that’s why it skips 6th element and starts over on the last while loop.
I would suggest you to include your ad code inside else -break branch.