I think below line of code is unnecessary, which is wrong if you looking for logged in user result.
if( ! is_user_logged_in() )
Please use below code, I make some changes for solution.
//Add a hook for a shortcode 'add_my_form' tag...
add_shortcode( 'add_my_form', 'get_form_on_role' );
//Create sortcode API used function...
function get_form_on_role() {
if(is_user_logged_in() ) {//If user is logged in...
//Get current user role information...
$user = new WP_User( get_current_user_id() );
$roles = $user->roles;
$returnTxt="";//Initialize return text variable...
if( $roles[0] == 'pro_user' ) {//If user having 'pro_user' role...
$returnTxt="HTML type 1";
}elseif( $roles[0] == 'administrator' ) {//If user having 'administrator' role...
$returnTxt="HTML type 2";
}
return $returnTxt;
}
}
/*
This will display 'HTML type 1' is user logged in with 'pro_user' role,
If logged in user with 'administrator' then it will print 'HTML type 2'...
*/
//You can use sortcode by API like...
<?php echo do_shortcode("[add_my_form]");?>
Reference: Shortcode_API
Let me know if there is any doubt/query regarding this.