How to make that all posts with a category belong also to another

You can bulk edit posts in the admin. I have never tried more than 500 or so but you can display 999 per page. To have more than the default 20 click screen options.

Click posts–>filter by Category A
Click Edit—> select all posts ( clicking top square next to “title”)–>Apply
Click Category B and Update.