Moodle already has that functionality so your aim is unclear. When a student logs on they are directed either to the home page or to their Dashboard (depending on what the admin has set).
Either of those pages gives them a clickable link to any course they are enrolled in.
If you really need a custom block why use JavaScript when a simple html link will do the trick? A custom html block with a URL in it will, under normal circumstances become a clickable link.
If you really want to do JavaScript in Moodle you will need to read the documentation provided for AMD modules. https://docs.moodle.org/dev/Javascript_Modules.
Perhaps if you take a little more time to define your objective clearly and to show that you have read some existing documentation, developers here will be willing to help.
At the moment it appears that you have not done a great deal of basic research.
Trying not to be mean