Chapter 9, Integrating C++ and the Unreal Editor: Part II, has a recipe called Creating new console commands, which you can refer to for more information regarding exec and the console command functionality