In the work, based on Lyapunov theory and linear matrix inequality (LMI) technique, we design a nonlinear controller for flexible bevel-tip needles to solve trajectory tracking problem by rewriting the dynamics in linear parameter varying (LPV) form. First, the bicycle model is adopted for the needles and an error path following model is further established. Then a Lyapunov-based controller is generated, and the error model is rewritten in LPV form accordingly to address the nonlinearity of the system. To ensure the performance of the designed controller and eliminate the uncertainty in parameter selection, an optimization problem with LMI constraints is then formulated to output the optimal parameters in the proposed controller. Finally, numerical simulations are conducted to illustrate the effectiveness of the proposed algorithm.