Are you sure it's pushed on far enough?
It looks like it's a keyed fit. Are you sure it's lined up properly?
Maybe you are missing some spacers for the bolts?
What did it look like before you took the old one off?
Compare the original inhibitor switch with the new inhibitor switch and see if they are the same.
A lot of people just buy it and then try and fit it and then find out it doesn't and sometimes it can be non-returnable (not sure about inhibitor switches) as well. Hopefully its the same part for you.