Swish movie query

I was learning a tutorial at the link:
It is a kind of flowing sand effect. when i tried to reproduce the movie sand effect, i got a weird effect about halfway through the movie. It seems like the sand starts flowing all over again even though the image is not yet complete.
Also the tutorial doesn’t explain how i calculate the new expanded width of the image.
I have attached the file with my own effect movie.

I think i posted in the right category. There is no separate forum for swish here.