If I followed you correctl, you want to insert values that do not yet exist in column stocknum.
Your immediate problem is that your query is not valid SQLite syntax. You cannot use values() with a where clause, you would need to select instead:
insert into stocks(stocknum)
select ?
where not exists(select * from stocks)
Now this is valid SQL, but does not do what you want. It inserts only if stocks is entirely empty. You would need to correlate the subquery with the outer query (which requires passing the parameter twice, or using a subquery):
insert into stocks(stocknum)
select ?
where not exists(select 1 from stocks where stocknum = ?)
Finally: if you are running SQLite 3.24 or higher, this is simpler achieved tiwh the on conflict clause. For this to work, you need a unique (or primary key) constraint on column stocknum. Then you can do:
insert into stocks(stocknum)
values (?)
on conflict(stocknum) do nothing