Use BuddyPress data in loop (mkdir)

it doesn’t work (ie, the folder name will just be “User – ” (with no
ID Number)

Did you check to see if and what bp_member_profile_data( 'field=ID Number' ); returns as a value? And that function will echo the value. To just return the value use bp_get_member_profile_data( 'field=ID Number' );

But… For God’s sake… Why would you use a member loop to do that?

And what is bp_member_profile_data( 'field=ID Number' );
The member_id? Or some custom id you assign per member? And if so, why?

For a one-time creation of such directories, I would do something like this, assuming you want a single directory for each user:

function create_user_dirs() {
 
    $users = get_users( array( 'fields' => 'ID' ) );

    $path = // put the absolute path to the existing 'SiteUsers' directory here

    foreach ( $users as $user_id )
        wp_mkdir_p( $path . "https://wordpress.stackexchange.com/" . $user_id );
      
}

If ‘field=ID Number’ is really different from the user_id, then do this:

foreach ( $users as $user_id ) {
    $id_number = xprofile_get_field_data( 'ID Number', $user_id, 'comma' );
    wp_mkdir_p( $path . "https://wordpress.stackexchange.com/" . $id_number );
}

Use wp_mkdir_p

I believe it sets permissions to 755 or whatever the parent dir is set to.