There are easily a billion ways to do this but starting where you have, to add something to the old init system you need to run the following:

sudo update-rc.d foo defaults

Where foo is your script name.

Some popular alternatives:

Edit /etc/rc.local to call your script before the exit.

Create an upstart script. This is the replacement for System-V init that Ubuntu has carried for the past few releases. It's fairly good if you want more control over when your script is called but it's a more work.

Launch it from within your X session (if this is a graphical machine) via gnome or another method (there are probably half a billion of these methods alone)