You inserted nulls for six of the eight p_nm values, so of course a query on the table returns what was inserted.
Note that since p_nm is varchar, values for it really ought to be quoted.
The stated requirement "227 data should repeat for previous record AND 121 data should repeat for previous records" cannot be reliably implemented because of a fundamental characteristic of relational databases: row content is independent of row order, row order is not a definably persistent table property; row order is defined
only by Order By clauses in Select queries which address the table. You need to review relational database basics, (eg
https://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch01.html).
If the table had a primary key, you could define a Trigger that sets p_nm column based on the PK, or you could create a View implementing that logic, or in 5.7 and later you could define a derived column using the same logic
Note also that with no primary key,
the table isn't a real table.
What problem are you trying to solve by trying to make p_nm values depend on row order?