It was all my fault of not looking into the core class files hard enough. There are 2 classes one url.php and site.php both can give you url of some format to suit your need.
The culprit I found is
URL::out('display_posts_by_slug',array('slug'=>$post->slug)). This line echos the url out of control whereas
URL::get(.....)returns the url to add up to a string to be returned by the plugin function. Alternatively I could also use
Site::get_url('habari')depending on whether installation is under domain or a subfolder.