You can use sed, match the before and after parts of the line and put a `.` in the middle. The command `s/ _REGEXP_ / _REPLACEMENT_ /` performs a regular expression replacement. `\(…\)` delimits a group; `\1` and `\2` in the replacement text refer to these groups.
sed
-e 's/^\(\\section\\*{[0-9]*\.[0-9]*\)\(}\)$/\1.\2/' \
-e 's/^\(\\addcontentsline{toc}{section}{[0-9]*\.[0-9]*\)\(}\)$/\1.\2/'
Another way to use sed is to replace the last `}` by `.}` if the line matches the desired pattern:
sed
-e '/^\\section\\*{[0-9]*\.[0-9]*}\)$/ s/}$/.&/' \
-e '/^\\addcontentsline{toc}{section}{[0-9]*\.[0-9]*}/ s/}$/.&/'
You can also use `\|` to combine two patterns but in this case I think it makes the code shorter but less clear.
If you want to replace the file in place, under Linux, you can use
sed -i -e … somefile.tex