Let $h$ be the "common perpendicular". Assume $c\sim h$ with ends on $A$ and $B$. Choose a homotopy and let $\alpha(t)$, $\beta(t)$ be trajectories of its ends (in $A$ and $B$ resp.). Pass to universal cover, let $\tilde\beta*\tilde c*\tilde\alpha^{-1}$ a joint $\beta*c*\alpha^{-1}$. Consider of geodesics $\tilde c_t$ from $\tilde\alpha(t)$ to $\tilde\beta(t)$. Let $c_t$ be its projection to Y-piece, it is a homotopy of geodesics from $h$ to a geodesic $c_1$ and $c_1(0)=c(0)$, $c_1(1)=c(1)$. Thus, $c\sim c_1$ rel ends. Since curvature is negative, $c\sim c_1$ rel ends implies $c=c_1$. (If doubt pass to universal cover.) Note that, the number of self intersections of $c_t$ stays constant; i.e. $c_1=c$ is simple.