If you're only connecting 2 devices - get a Y midi splitter cable. More tna that and you'll need a thru box as Yoda says.
When you have multiple midi devices you normally connect them as a chain - the 'out' of one to the 'in' of the next. Sadly alot of guitar pedals just have and 'in'.....