You need to set the output to
open drain,
not push pull!
What is the operating voltage of the µCs GPIOs? The controllers themselves are supplied by 5 V, so I'd expect the pull-up resistor going to 5 V, too. Unless, that is, when the µCs operate on 3.3 V using internal voltage regulators to create the 3.3 V from teh 5 V supply. In that case having the pull up to 3.3 V is perfectly o.k.
when i a make high any of the port the bus line will be pulled high and when i make both the port lines low the bus line will be 0V. Is my understanding correct?
By no means, sorry.
When any output (µC-A or µC-B) is low, the bus will be low, too.
Only when both outputs are high, the pull up resistor will drive the bus high.
In the schematic you show, I see no particular use for a wired or. If µC-A is driving and µC-B is receiving, you can configure the GPIOs as output and input, respectively. Or vice versa, when the direction is from B to A.
If both µC can be driving, who is going to receive the driven signal? You show no other component on the bus.
Also note that a wired or is typically much slower than a bus driven by totem pole outputs. The pull up resistor creates an RC-term with the capacitances on the bus (wiring, pin capacitances) which generates a comparatively slow rising waveform. If you need to be fast, wired-or (or wired-and etc.) is the wrong decision. Use fast logic gates or bus drivers for such an application.