Here are sketches of two methods.
df <- iris
#Method 1
SETOSA <- density(df[df$Species=="setosa","Sepal.Length"])
VERSICOLOR <- density(df[df$Species=="versicolor","Sepal.Length"])
VIRGINICA <- density(df[df$Species=="virginica","Sepal.Length"])
plot(SETOSA, main="Density Plot", ylab="Frequency",
xlim=c(3.5,9))
lines(VERSICOLOR,col="red")
lines(VIRGINICA,col="blue")
#Method 2
library(ggplot2)

ggplot(df,aes(x=Sepal.Length, color=Species)) + geom_density()

Created on 2022-01-05 by the reprex package (v2.0.1)