Sorry for the slow response.
Are you trying to create a trajectory (what i assume you mean by a .h5 file) for each protein?
If so I would suggest you use something like the following:
import MDAnalysis as mda
u = mda.Universe("topology.tpr", "trajectory.h5md")
protein_1 = u.select_atoms("some selection that selects protein 1")
with mda.Writer("output.h5md", n_atoms=protein_1.n_atoms) as W:
for ts in u.trajectory:
Let me know if that helps. FYI your original code is not visible.