I found the "learndash_mark_complete" but it shows a button to complete. I want to complete it programatically for a few users in a few courses
I believe you're looking for the learndash_process_mark_complete() function, which according to LearnDash "Updates the user meta with completion status for any resource."
It accepts the following arguments: