How to display a single(current) post from a category

What you probably want is this:

1) A main page that displays a list of all posts in a certain category.

2) A page showing the individual post in this list on which the user has clicked.

To create page number, you don’t have to do anything. WordPress has an automatic scheme for URLs for you. Just use :

http://yourdomain.com/category/name-of-you-category

This page will display a list of all the posts in this category (provided you left the default category.php page untouched in your theme’s folder).

Then, when a user clicks on a post in this list, he will be sent to the corresponding post page. This page is built by WordPress using your theme’s single.php page. So if this is where you have inserted the code you are showing us, it is wrong and I understand you will get a list of all posts. Just replace your code with this one :

<?php get_header(); ?>
…
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<h1><?php the_title(); ?></h1>    
<?php the_content(); ?>
<?php endwhile; // end of the loop. ?>
…
<?php get_sidebar(); ?>
…
<?php get_footer(); ?>

This will only display the content of the currently viewed post (designated by the URL and automatically retrieved by WordPress default query).