If you are asking it seems you didnt understand the words in my post to you.
So here is a full edit version of your code, with the corrections I suggested to you.
x=c(1,2,3,4)
y=c(4,5,6,7)
example1<-function(x,y)
#start functions in curly bracket
{
#initialize the values to store squared values
n<-length(x)
x1<-0
y1<-0
z1<-0
#then start iterations
for(i in 1:n)
{
x1[i]<-x[i]^2
y1[i]<-y[i]^2
z1[i]<-(x[i]/y[i])^2
}
#close with curly bracket
sumx1<-sum(x1)
sumy1<-sum(y1)
sumz1<-sum(z1)
g<- sumx1/ sumy1
h<- sumz1
cat("The values are",g,"and",h,"\n")
}
example1(x,y)