user_presave doesn't work correctly when new account is created
As stated in the documentation (https://api.drupal.org/api/drupal/modules%21user%21user.api.php/function/hook_user_presave/7), you need to check whether the user is being created or not with the following code:

if ($account-&gt;is_new)

The reason is that $edit contains the values submitted, and $account contains the existing user data - but on user registration, there is no user that already exists in the database.
Your code should check whether new user is being created and in that case assign some default value (like you already have with $B= taxonomy_term_load($tid);)