How i can get post data from database when i am getting post id from url in wordpress

You may use $_GET parameter to get the id.

$id = $_GET['id'];

Or try this:

global $post;
echo $post->ID;

But it seems you have a problem in the args array. when you know the exact id of requested post you don’t need to use it like that. you can use this instead:

get_post($id);

And then you do not need to loop through because you have one post to show.