Plugin that generates a page of post content

I still don’t exactly get it. I would advise you to take it one step at a time first. Your function takes in a post_id, so that is an existing post. If you then get that post’s title and then you call get_page_by_title, obviously that is going return you the same than get_post already did. Your logic is flawed I think. Could you just write a list of steps in english of what you would like to achieve?

If what you try is just stop a post/page from being published if one with the same title already exist, just know that in itself it already exists, because wp makes autosaves and drafts and the like. In essence you probably want to prevent the post_status going from ‘draft’ to ‘published’.

If that’s what you are after, check this question:
Prevent post from being published if custom fields not filled

To figure out if a post with the same title already exists, the codex entry for get_page_by_title explains how:

Retrieves a post given its title. If more that one post uses the same title, the post with the smallest ID will be returned.

So:

if( $post_id !== get_page_by_title( $post_title ) )

    $page_exits = true;

If you call exit(), you terminate execution. It is probably not what you want and will break your website. If you want to stop the function, just use return; Once you return, nothing else will be executed from this function call, so it doesn’t make sense to do another test for $page_exists later, because if it existed that test wouldn’t even be executed because the function had already returned…

Maybe some sort of learning php book or some tutorials could help you advance…

WordPress is not necessarily the easiest thing to program for…