It is not possible to transfer the visa from one passport to another, without making a new visa application. However, the B visa if the B visa is still valid you can present it together with your new passport when seeking entry into the US
Note: The Embassy no longer issues visas valid "indefinitely".
If the passport in which your visa has been endorsed has expired, the visa in the old passport can still be used, provided you carry a valid passport of the same nationality along with the expired passport.
Note: When canceling your old passport, if the passport authority has clipped the corners of the passport and in doing so, has damaged the visa in any way, that visa is no longer valid and cannot be used for travel to the U.S.