We study numerically nonlinear dynamics of several types of molecular systems composed of hydrogen-bonded chains placed inside carbon nanotubes with open edges. We demonstrate that carbon nanotubes provide a stabilization mechanism for quasi-one-dimensional molecular chains via the formation of their secondary structures. In particular, a polypeptide chain (Gly)N placed inside a carbon nanotube can form a stable helical chain (310-, α-, π-, and β-helix) with parallel chains of hydrogen-bonded peptide groups. A chain of hydrogen fluoride molecules ⋯FH⋯FH⋯FH can form a hydrogen-bonded zigzag chain. Remarkably, we demonstrate that for molecular complexes (Gly)N∈CNT and (FH)N∈CNT, the hydrogen-bonded chains will remain stable even at T=500 K. Thus, our results suggest that the use of carbon nanotubes with encapsulated hydrogen fluoride molecules may be important for the realization of high proton conductivity at high temperatures.