I hope I could simplify this problem to just find all the combinations
of characters. The final printing seems not very related to the puzzle.

Here is my thoughts,

You want e.g [‘a’, ‘b’, ‘c’, ‘d’] and all the combinations of different
characters, so that means you will get:

-1 diff
a | b | c | d

-2 diff
ab | ac | ad
| bc | bd
| cd
-3 diff
abc | acd
| bcd

-4 diff
abcd

You see the pattern? So it is quit easy to make an iterative algorithm
to find these combinations. Or I think you might use recursive idea to
find the answers if you put it this way:

Of all the 2 chars combinations that start with ‘a’, the second char
must be from rest of the array. This way, e.g. [‘a’, ‘b’, ‘c’, ‘d’] will
first find ‘cd’ then ‘bc’, ‘bd’ then ‘ab’, ‘ac’, ‘ad’

Hello!
Uhm, what I’m trying to do is to have all the possible combination even
including the same character more and more time in the so generated
word.