Generate Parentheses Giving wrong answer

It is giving wrong answer . I have run it on upto n=5 it is giving output as expected. Dont know why it is giving wrong answer

Hey, it might be because n can be larger than 5 ( 1 <= n <= 11). kindly share your code through cb.lk/ide, if you face any other problem.