You can use the the_content
filter to add code directly into the content.
add_filter( 'the_content', 'wpse_202010_modify_the_content' );
function wpse_202010_modify_the_content( $content ) {
global $post;
if ( in_array( $post->post_type, array( 'post', 'page' ) ) ) {
$content="<p>New content here</p>" . $content;
}
return $content;
}