Use crontab.
As root give the following following command:
$ crontab -e
This opens the crontab editor of your choice. Enter the following in that:
@reboot echo 2 > /sys/module/hid_apple/parameters/fnmode
Save and exit the editor. Your setting will be done on each reboot. Hope this helps.