It appears as though you want to alter the content only if you are on a post in the 'private' category and the user is not logged in. Here is what I would recommend:
add_action( 'init', 'my_init' );
function my_init() {
if( in_category( 'private' ) && ! is_user_logged_in() ) {
add_filter( 'the_content', 'post_restrictor' );
}
}
function post_restrictor( $content ) {
$content = "Sorry, you don't have access to this post. Please login.";
return $content;
}