I would imagine that you have a Whirlpool or Kenmore, and you removed
the two screws to the right side of the tub opening that held the lid
switch to the cabinet. If this is the case, and if the switch itself
is still in one piece, then putting it back would be a simple matter.
But I am guessing from the description of your problem that the switch
iself is broken, and if you buy another one and find some instructions
on the internet to install it, your problem should be solved.