how generate  part of scriptSig in bitcoin transactions
The data to be signed is called Hash Preimage. Then you sign the double SHA256 of hash preimage, which is 256-bits long. Before hashing, the data must be formed as shown in this answer. If you're signing a SegWit transaction, the contents of the preimage changes, as defined in BIP 143.

Then you can use the formulae here, Eq. 2:

(x1, y1) = k × G(x, y) mod p
r = x1 mod n


k is a random number, G is the generator, p is the prime modulo, etc.

Then,

s = (k^-1 (h(m) + d * r)) mod n


d is the private key, h(m) is the double SHA256 result. Now, you can use r, s to create the DER-encoded signature.