after suitable completion, your command definitions work OK[1] for me. Perhaps you are not loading the ifthen package (that provides the \whiledo command)? Do you have the following line in the preamble of your document?
It doesn't work because \printent internally uses the \newline command. The line \printint{6} in your code will result in using a \newline command outside a paragraph and this will produce an error.