Checking if val is present in list I pretty sure it should be shoter solution.

(defun modulename-vinlist(val lst)
  "Check if value in list"
  (let ((res "no"))
    (let (vv)
      (dolist (pi lst vv)
        (when (string-equal pi val)
          (setq res "yes")
          (return))
        (setq vv (cons pi vv))))
    (when (string-equal res "yes")
      t)))
You want member:

(member val lst)


For example

(if (member 3 '(1 2 3)) t nil) ; t
(if (member 4 '(1 2 3)) t nil) ; nil