Hello,
the rule is not the part that needs changing, it's the action / script / permissions that need some tuning. User A technically does not need full Contributor permission on folder B, only the permission to add another child node to it. So, giving user A only the permissions Read + AddChildren on folder B suffices for the rules action / script to move the document from folder A to folder B. Additionally, you need to withdraw ownership status of user A on the document to exclude any permissions granted by that, otherwise user A will always be able to do what he wants with the document.
Normally, I would write such an action in Java in order to make use of the broader API there. E.g. I can move the document with Java without having to give user A any special permissions just for this action.
Regards
Axel