All may not be lost just yet. As there is really no new data on Machine "B", formatting it and starting again should not be a problem.
On Machine "A", run a Time Machine backup to an external drive.
Once complete, fire up the newly formatted and OS X installed Machine "B" and connect the external to it.
Then at the question "do you have a backup" (words to that effect) answer Yes and point Machine "B" at the external with the TM backup on it.
Let it do its thing and when finished you will have a machine that is identical to Machine "A".
Any erroneous "Home" folder can be deleted leaving you with just the original one.

Another way, if you do not like that option,
On Machine "B" open the SHARED folder, on Machine "A", open the Home folder.
Now you have to copy the CONTENTS of each folder, One at a time, within the Home drive of Machine "A" into the SHARED folder of Machine "B".
Then move those files into the folder with the same name in the Home drive.
This eliminates any Ownership/Permissions problems which can arise by just copying the entire folder directly into the new Home folder.

Take you pick