A function to get the initial clustrers, mean and covariance of the clusters

I'm still an amateur in R programming. I'm trying to write a function to get the initial clustering using InitCluster(x_{1},x_{2},..., x_{n}; K) and also to get the mean and covariance for all the clusters. I'm trying to use the code below:

data<- data(iris)
initialClasses <- 2
x = iris[,-5]
y = iris$Species
kcl <- kmeans(x, centers = 3, nstart = 10)
initClust<- kmeans(x, initialClasses, iter.max = 1000)
x$classes <- initClust$cluster;x$classes
x$classes

I have been trying but all to no avail as the function i tried to write was outputting the the same codes. I would really appreciate any help of guidance as to go about it as I'm still a baby in r. Thanks