Why testcases failing?

Sir, some testcases of my submission are failing,
help me whats the issue.
here is my code

hi @sumitlohan
your test cases are failing for the cases when value of k is greater than the size.
in such cases you should take mode(%) of k with n and then call appendLastn function.

@sumitlohan
please mark your doubt as resolved and rate my work as well

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.