Create server side text from wordpress page

One issue with your original code is that the returned $queried_post is a php object, which can’t be output in whole with a simple echo. If you tried to echo a property of the object, like echo $queried_post->post_title; that might work.

That said, I’d handle this with a rewrite endpoint to keep things self-contained. The below code adds the endpoint data-feed, which when visited will output the title of the post as text/plain.

function wpd_rewrite_endpoint(){
    add_rewrite_endpoint( 'data-feed', EP_ROOT );
}
add_action( 'init', 'wpd_rewrite_endpoint' );

function wpd_parse_query( $wp ){
    if( array_key_exists( 'data-feed', $wp->query_vars ) ) {
        $post_id = 7914;
        $queried_post = get_post( $post_id );
        header( "Content-Type: text/plain" );
        echo $queried_post->post_title;
        exit;
    }
}
add_action( 'parse_query', 'wpd_parse_query' );