What is use of these two directories in apache2 and how can we do it?
You configure your site mysite by creating or editing the file mysite.conf in sites-available (you can also configure several sites in the same .conf file, if you prefer).
After this, for publishing the site you must create the correspondent symlink in sites-enabled. In Ubuntu you can do it like this:
a2ensite mysite (with sudo, if necessary; and without the final .conf)
And then you must reload Apache:
sudo service apache2 reload
Later, if you want to modify the configuration, you only touch the mysite.conf in sites_available. Changes apply automatically in sites_enabled, through the symlink. Just remember reload Apache.