How to map function key (F1-F12) to perform like they do with builtin keyboard on Macbook
I recommend using the free tool Karabiner-Elements to accomplish this. After you've installed it, go to the Function Keys tab and set each key's behavior as desired. Below is a replica of the default key behaviors on a 2014 MacBook Pro, for example. If you want to only remap the function keys on your external keyboard, then uncheck the internal keyboard in the Devices tab.