Hi, I reply myself...
Finally I was able to do it!
I created a quiz programmatically and I'm able to see it on Moodle.
You just need to use this function (Tim mentioned it) properly:
$quiz = add_moduleinfo($quiz, $course, null)It is included in
https://github.com/moodle/moodle/blob/master/course/modlib.php#L44