Goal: Compute MST of $G = (V, E)$.
We have $ N = \lvert V \rvert $ in your pseudocode.
In the lecture note there is no definition for T or N or u or v.
You can represent an edge $e \in E$ as a tuple $(u, v)$, where $u,v \in V$, meaning vertex $u$ has a link with vertex $v$.
Also, note that a Tree must have $N - 1$ edges, and no cycles. Kruskal deals with cycles by using a Disjoint Set Data Structure.
Step 1: Initialization and Sorting
Initialize $ ~ T = \emptyset $.
Sort $~E~$ by edge weigth.
Step 2: Building T
If you naively take only the first $n$ edges there's a chance that $ ~ T ~$ will contain a cycle, and therefore be a MST. That's why there's an if statement checking whether two vertices are already in the same component. Looking at the example I've modified from Wikipedia:
If you greedily chose edge $(D,B)$ you'll end up with a cycle, however both $D$ and $E$ are in same component (green), so the if condition fails.
Now the next iteration will check the next edge in sorted $E$, i.e. $(B, E)$.