Miika,
My code was adapded to the problem defined in the first post.
Specifically the subfolder is distinguished by one last character (A, B, ..., n).
The script collects all those last characters, and then for each character (A, B, ..., n) looks for shapefiles ended with this character. When such shapefile is found, it's added to a list to merge. When all subfolders are checked this list is used as an input to Merge tool (which runs once for shapefiles with specific suffix).
I suppose you may experience recreating output file because your subfolders can have the same last character.
If your subfolder are distinguished by more than one character (eg. 2, 3, 4, ... characters), you can just change value in line:
suffixLst.append(subfolder[-1])
Moreover, this script won't be working for geodatabase feature classes because it contains file extensions handling specific to shapefile.
If you can, please provide screenshot of your subfolders so I could ajust this script.