Hello,
You do not need any custom code to add categories on your menu as this feature is provided by WordPress itself.
You can easily add categories on you menu or your submenu by visiting Dashboard -> Appearance -> Menus, then adding your categories to your menu from the category dropdown on the left labeled Categories.
Make sure you have positioned the categories where you intend to add it from the left side of the page.
Hope it helps.
If you want more dedicated and swift support on the theme, please visit the theme’s official support forum where the theme’s official support team are stand by to answer each and every one of your questions.
https://themepalace.com/forum/profitmag/
Best regards.
Have a good week ahead.