As a variation of De Bruijn graphs on strings of symbols, the graph of overlapping permutations has a directed edge $\pi(1)\pi(2)\ldots \pi(n+1)$ from the standardization of $\pi(1)\pi(2)\ldots \pi(n)$ to the standardization of $\pi(2)\pi(3)\ldots \pi(n+1)$. In this paper, we consider the enumeration of $d$-cycles in the subgraph of overlapping $(231, 4\bar{1}32)$-avoiding permutations. To this end, we introduce the notions of marked Motzkin paths and marked Riordan paths, where a marked Motzkin (resp. Riordan) path is a Motzkin (resp. Riordan) path in which exactly one step before the leftmost return point is marked. We show that the number of closed walks of length $d$ in the subgraph of overlapping $(231, 4\bar{1}32)$-avoiding permutations are closely related to the number of marked Motzkin paths and that of marked Riordan paths. By establishing bijections, we get the enumerations of marked Motzkin paths and marked Riordan paths. As a corollary, we provide bijective proofs of two identities involving Catalan numbers in answer to the problem posed by Ehrenborg, Kitaev and Steingrímsson. Moreover, we get the enumerations of $(231, 4\bar{1}32)$-avoiding affine permutations and $(312, 32\bar{4}1)$-avoiding affine permutations.