I am able to generate all permutations greater than the string but not able to print them in sorted order

Store required permutations in an array and print them after sorting the array.

tried what you suggested, still not working

can you suggest how to sort the array after storing all possible permutations greater than input

Take a vector of strings and push every permutation you need.
And just sort the vector using C++ STL.