Create a block with sorting in drop down Using Organic group module, In the block I want to create sort dropdown as shown in image. Which will allow to sort the data according to various parameters like date, tag, group etc.

How can I achieve it programmatically.
You can use table display to manage the listing of all the posts.
Now to filter/sort the data you can user ctools jump menu. Using Ctools jump menu you can create various menu items for different sorting type.

To see the example of Ctools jump menu see the ctools_ajax_sample module which comes with Ctools module package.