Those "loose cables" are probably part of the stock exhaust's EXUP system. I'm kinda surprised the the previous owner left them dangling there.
If you go back to stock pipe plenty of people here can help you out with how to hook them back up.
You might want to look into an FmF Q4 pipe. If you don't want to go back to stock.
Is there a spark arrestor in end of pipe you have?
There's also something called a DB Dog that you can look up. It's an insert you can put in end of pipe.
Not sure if there's one specific to a Yosh pipe or not.
_________________
2008 WR250X
Gearing: 13t - 48t
Power Commander 5 / PC-V
Airbox Door Removed - Flapper glued - AIS removed
FmF Q4
Bridgestone Battlax BT-003rs