I created a script to add 100 space characters at the end of each line:
#!/bin/ksh
sed -i -e 's/\n/ - 100 spaces - /' $1
but it doesn't work and I think it is because of \n. Any thoughts?
Although Karoly has already pointed out the error in your script, you could also save yourself typing 100 spaces by using a condition and break to make a sort of loop
sed ':1;/ \{100\}$/!{s/$/ /;b1}' file
Will print 100 space at the end of the line
If there are already spaces at the end and you want to add 100
sed 's/$/1/;:1;/1 \{100\}$/!{s/$/ /;b1};s/1\( *\)$/\1/' file
Just a suggestion to avoid typing 100 spaces (although I'm sure that by this time, you already have!) - use perl:
perl -pe 's/$/" " x 100/e' file
As the other answers have stated, this matches the end of the line and replaces with 100 spaces, using the e modifier to allow you to write " " x 100 and let perl do the work for you.
As with sed, you can modify the file in-place using the -i switch - as with sed, I'd suggest using something like -i.bak to create a backup file file.bak.
Could be the \n as that's undefined by POSIX and so implementation dependent across seds but you also say you want add spaces to the end of a line while your script is trying to replace the end of line with spaces.
In any case this is not a job for sed, just use [s]printf("%100s","") in awk to create a string of 100 blanks, e.g.:
$ echo "foo bar" | awk '{printf "%s%10s%s\n", $1, "", $2}'
foo bar