Create a setting at backend,to print only selected categries at front-end

Wow, we don´t need all that code (at least I didn´t read it). Let´s look at your problem from a conceptual side.

You want to choose categories on the backend to be shown in the frontend, if I understood you correctly.

The steps would be the following in the backend:

  • Build something to select categories in the backend
  • Save what you just selected (comma seperated list could be one way) to the database (wp_options would be the place to save it to)

In the frontend:

  • Retrieve your saved information (a single field from wp_options)
  • Split your information into an array (explode() a comma seperated string)
  • Pass this array as a parameter to a query of your choice (get_posts() or WP_Query() for example)
  • Retrieve only posts from the categories and work on with them…