Add object and shadow over a background using the compositor
In my opinion you are overcomplicating things.

Since you are using the new shadow catcher feature available in 2.78.5 you don't need to do much.

Set the plane that will receive the shadow, and set it to be a shadow catcher in Cycles Settings> Ray Visibility.

 

The rendered image will have the shadow and the rest of the plane will be transparent:



Then just overlay the rendered image onto your background using Alpha Over: