I see you are using “Divi” theme and that uses “Layout Builder”. You can not insert Php function in the layout builder. However what you can do is install this plugin to execute php within the posts / pages ( it’s quite old plugin, try to see if you can find something similar).
https://wordpress.org/plugins/wp-exec-php/
and then put this in your text module
<?php
if ( is_user_logged_in() ) {
echo 'Welcome, Member!';
} else {
echo 'Access only for members, to view and buy membership package click here
';
}
?>
The above code gives you a hint how to go about what you are trying to do.