If you want to first run the commands interactively on one machine, and then have a script to run them on others, just open your .bash_history (or whatever your shell uses) in a text editor, and remove whatever mistakes you made the first time around. Voila! You've got a script that you can copy to the other machines (with scp, rsync, whatever).
In some cases you may have to process the file slightly first. For instance, I use zsh, and have it configured to add various metadata (datestamps). Obviously you'd need to remove this. You can easily do this in vim or TextMate, or probably any decent editor using block selection. Or you can use awk or cut to output everything but the metadata. Here's one way to do this:
cat .zhistory | cut -d';' -f2-
But most of the time you'll find your history file is just a straight list of commands, so you probably won't need to worry about any of this massaging.