Do you have a sample of a macro that you are working on to do that? Where are you getting stuck?
My approach would probably be to
- manually select the previous folder in finder so that it is selected
- trigger the macro
- simulate a copy command to get the folder text into the clipboard
- parse the clipboard text to extract the letter
- generate new folder text based on the letter detected
- simulate keystroke to create a new folder in the finder
- paste the generated text
- simulate return keystroke to finalize name of folder.