Filler to fill gap between frame and wood in the balcony
The piece under the slider sill appears to be face nailed facia.  You try removing this piece of wood, maybe they did water proof properly and only this piece of facia is rotting.  If it is only the facia rotting then you could replace it and then to seal the gap, depending on the size, use a piece of foam backer rod and some exterior grade paintable caulking.  The backer rod allows the caulking to properly expand and contract.

I'd pull the bottom piece and replace it with PVC facia.  Home depot carries it but you could probably find others.  After replaced use backer rod to fill the gap and caulking to seal it.

For caulking I'd probably go for something like:

GE M90026-30 Paintable Silicone Supreme Window &amp; Door Sealant Caulk

For backrod size, you generally want something slightly bigger than the gap.  Sometimes if the gap varies over the width you'd start with a larger diameter until it couldn't fit and then move to a smaller one.