appointment plugin doesn’t display all appointments

Generally, replacing content, especially with output buffering, is, at least in my mind, not very good practice. So you might consider making use of wordpress’ templating system – see Codex: Templates for a start.

The former would also lead to, where your markup has to go. Or if you not using templates you have to write it into above files. Actually you are making use of templates already, with:

get_template_part( 'content', get_post_format() );

Which is looking for content-the-post-format.php, but shouldn’t this be:

get_template_part( 'content', get_post_type() );

So you can create a template file content-the-post-type.php for that.

Additionally you are using $posts as variable name which is a global variable name used by wp, so this will lead to problems. Change the variable to a none-used/reserved name, generally, try using distinct and unique names to avoid conflicts. There is not need for the global $post; you are doing, you should also add wp_reset_postdata() to your code. Best you take another read of – at least – Codex: get_posts() to learn more yourself about how to do this.

These are just some pointers of course, but they should get you going into the right direction.