I'm replacing a motion sensor light switch.There are two switches to contol this light. I swapped wire for wire
That sensor doesn't support 3-ways, so you were correct to replace it
The Topgreener TSOS5 doesn't support 3-way operation, only single-pole use (note the lack of a traveller wire/terminal on it), so you were correct to take it back and replace it with something suited for 3-way service.  (Trying to adapt a motion-sensor to 3-way service using a relay would lead to somewhat...counterintuitive behavior, I suspect.)