When you calculate reducedMatrix
you always skip over the first row. This works for the first row of the cofactor matrix, but for the rows below you need to skip over row j. This is why your output consists of the first row repeated.
By the way, this is a horrible way to calculate the inverse of a matrix. I assume this is an academic exercise, not meant to be used in serious programs.