Calling batch from finish of same batch job

Trying to implement Dan Appleman solution to call batch job from finish method of another batch job. Bu the execute method is continously looping. Can someone suggest me on ways to improve my batch class to achieve what Dan got explained in his solution (calling a method in the finish of batch job which again calls the same batch job when there are still records pending). Thanks