You might have misread the description that you copy paste. The arguments of K.hom must be the list of the images of the generators. In your case, there is one generator for K (which is gen1). Even L is an optional argument.
sage: K.hom([gen2])