You could use something this:
(defun add-tangle-headers ()
(message "running in %s" (buffer-file-name))
((f-ext? (buffer-file-name) "py")
(insert "# This is a generated file do not edit\n"))
((f-ext? (buffer-file-name) "el")
(insert ";;; -*- lexical-binding: t -*-\n"))
(add-hook 'org-babel-post-tangle-hook 'add-tangle-headers)
The idea is to insert the desired line depending on the kind of src file you are tangling.
I would have thought you could use a :prologue header arg, but this seems to be only for execution.
Alternatively, you might try noweb:
First, name some source blocks like this with the header you want in each one.
;;; -*- lexical-binding: t -*-
# This is a generated file do not edit
Then, add a noweb yes header arg, and the target in the blocks where you want them.
#+BEGIN_SRC emacs-lisp :tangle test.el :noweb yes
#+BEGIN_SRC python :tangle test.py :noweb yes
These will tangle as you want.