Why it is not recommended to create your own random generator number? I read in a book: mastering bitcoin that one should not create his own random number generator and instead use a cryptographic secure pseudorandom number generator (CSPRNG) 

Why is it so? Say I'm writing a simple python code to choose a number between 1 and 2^256 in the following way: create an array with 256 bits, fill up each index with a random number (1 or 0) 

Why, or in what way, it is inferior to the CSPRNG? and how is this code is predictable?
So, you use integrated Python random, instead of CSPRNG. The problem is here: integrated random functions in programming languages are designed to be very fast, and they have some small period. For example, in C#, standard Random class is seeded by 32 bit integer. Let imagine I use it to generate 256 bit number, like you.

In this case, it can generate only 2^32 different numbers (one for each seed). But we know, there are 2^256 such numbers. If I have generated 256 bit number with this method, anyone can hack my number. He just have to run generator for all possible seeds. 4 billions is very small number and anyone with PC can brute force it.

In case with bitcoins, that means, anyone can restore your private key and steal your bitcoins. Because you used weak random.