BASH or applescript keygen

Please help me to make this script to create a key based on these parameters:

the output of $USER is smithm for mike smith
the output of id smithm is uid=1042(smithm) gid=20(staff) groups=20(staff), 1025(group1), 1057(group2), 1028(group5), 1038(group3), 1037(group4)

I need a script that puts last letter, first letter of username (ms)
then puts uid (1042)
then appends 09 to the end of each user

so for mike smith is would be: ms104209

I need a script that would do this for any user who runs it.

please help, thanks!