Creating a probability density function for a particular dataset I want to create a probability density function for a particular dataset. First of all, I calculate the mean and the variance of my dataset. So, I use the mean and the variance to create a probability density function, for example, Gaussian distribution. Is my thinking correct?

A nonparametric way to estimate a density corresponding to your data is through kernel density estimation.
Given an iid sample $(x_1,...,x_n),$ this method estimates your density function as
$$\widehat f=\frac{1}{nh}\sum_{i=1}^n K\left(\frac{x-x_i}{h}\right)$$
for a suitable choice of a bandwidth parameter $h$ and kernel $K(\cdot)$.
I encourage you to read the wiki article for details. Further lecture notes are here.
