The knock sensor on my Subaru legacy is bad. I want to place it myself. Easy fix?

I drive a 1996 subaru legacy. 127k the current miles. My check engine light came on two weeks ago. My headlight, drivers side went out too. I took it to the dealer to have it fix. $95 for diagnostics and when it was all said and done I got a bill for $1600. Which included a new catalytic converter $900.00. I paid the price as I got this car for free. “Cheaper than a car payment.” On the way out of the dealer ship the check engine light comes on. I drove back to the dealer ship. Dropped off my car for the weekend. Now on Monday the knock sensor is bad. I want to replace it myself. Seems like a quick easy fix? But which knock sensor should I buy? The price range is $16 to $132. Why such a range? Is one really that better than the other? Costs $230.00 at dealer to replace a knock sensor! Am I getting knocked around? Thanks for accepting my question.