I think I know what you are trying to do... but I'm not sure...
If you are pressing a number combination 1 2 3 4 that gets cached then translated and separated with your for loop... then you really just need spaces in between them.
Code:
function function_name () {
COMMANDS="$1"
# will automatically loop with each word. No sed needed.
# if you need to change the field separator to anything other than white space... you need to change an environment variable
# I forgot what it is at the moment.
for digit in $1; do
...
done
...
}
# Each word will be treated as a separate loop through the for loop.
function_name "one two three four"
However, it would be better to not have to quote the numbers and just use "$@" in place of "$1"
It's kind of hard to understand what you are trying to do with the for command if you don't tell us more information.