As this is a school project, I'm not giving the direct solution. I'm sure you can do it by yourself.
You already have the answer hidden in your script. Just use 4 lines. You have drawn x and y axes using the same. Just modify those an you will have your rectangle.
Create end point coordinates from the dimension values. The following code will draw a line between point (x1, y1) to (x2, y2). By this way you have to write 4 lines of code to draw 4 lines.
line([x1, x2], [y1, y2])
However, you can also create a matrix to draw multiple lines in one go. See the matlab documentation for details.