Well, one option could be :
to go from one step to the next,
- Let p = n-1
- you take (p)th letter abdc => d.
- you take next letter according to your order.
- if it exists, then you write it, then end your word with remaining letters ordered
- else, p = p - 1 and you go back to previous step.
- you take next letter according to your order.
Not sure it is the best way to do. Why wanting to go from one step to next ? why not writing all words, begining by writing (n-1)! words begining by first letter, then (n -1)! by second...
a
a
...
a
b
b
...
b
for each one of these words : continue (n-2)! with second letter and (n-2)! with third letter :
ab
ab
...
ab
ac
ac
....
ac
....
ba
ba
...
bc
bc
....
and so on